zoukankan      html  css  js  c++  java
  • 存储过程

    存储过程分三种:系统存储过程,以sp_开头;扩展存储过程,以XP_开头;用户自定义的存储过程。

    存储过程定义:

    create proc [存储过程名] --自定义

    @[参数] 参数类型,

    @[参数] 参数类型 output, --有输入输出

    as

    (sql 语句)

    调用存储过程

    declare @id int

    exec 存储过程名 参数名 print @id

    存储过程的3种传回值:   1)、以Return传回整数   2)、以output格式传回参数   3)、Recordset

    vs2005中调用存储过程:

    CREATE PROCEDURE AddCar @PayCar varchar(50), @XiuLi varchar(50), @DateTime varchar(50) AS insert into CTable values(@PayCar,@XiuLi,@DateTime) GO
    cs代码 con.Open(); com = new SqlCommand("AddCar", con); com.CommandType = CommandType.StoredProcedure;   com.Parameters.AddWithValue("@PayCar", PayCar); com.Parameters.AddWithValue("@XiuLi", XiuLi); com.Parameters.AddWithValue("@DateTime", addtme); com.ExecuteNonQuery(); con.Close();

    SqlConnection con= new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["conn"]);              con.Open();

                SqlDataAdapter  sda = new SqlDataAdapter("存储过程的名字",con);

                sda.SelectCommand.CommandType = CommandType.StoredProcedure;

                DataSet ds = new DataSet();

                strselect.Fill(ds);

                DlstBuycatalog.DataSource =ds;

                DlstBuycatalog.DataBind();

                con.Close();

  • 相关阅读:
    NET导入Excel带进度条。
    直接拿来用,最火的.NET开源项目(beta)
    Darren Ji
    接口和抽象类有什么区别
    wpf博客
    jQuery动态改变图片显示大小(修改版)
    S32K的make过程
    TortoiseGit安装及使用
    Python:tkinter
    GCC学习笔记(二):编译选项
  • 原文地址:https://www.cnblogs.com/xu3593/p/2821538.html
Copyright © 2011-2022 走看看