2023年6月21日发(作者:)

如何定义和使⽤存储过程⾃定义存储过程的格式如下:

存储过程执⾏格式:Exec sp_getsome 1230在c#中使⽤存储过程的⽅法:SqlConnection con = new SqlConnection("server=.;database=订货;uid=sa;pwd=123");();string str = "sp_getsome";//只需将cmd的str参数设为存储过程名字即可SqlCommand cmd = new SqlCommand(str,con);dType = Procedure;//将CommandType默认的text改为StoredProcedureSqlParameter sp=("@salary", ); = 1230;//上两⾏为存储过程添加参数DataSet ds = new DataSet();SqlDataAdapter sda = new SqlDataAdapter(cmd);(ds,"职⼯");urce = ["职⼯"];nd();

2023年6月21日发(作者:)

如何定义和使⽤存储过程⾃定义存储过程的格式如下:

存储过程执⾏格式:Exec sp_getsome 1230在c#中使⽤存储过程的⽅法:SqlConnection con = new SqlConnection("server=.;database=订货;uid=sa;pwd=123");();string str = "sp_getsome";//只需将cmd的str参数设为存储过程名字即可SqlCommand cmd = new SqlCommand(str,con);dType = Procedure;//将CommandType默认的text改为StoredProcedureSqlParameter sp=("@salary", ); = 1230;//上两⾏为存储过程添加参数DataSet ds = new DataSet();SqlDataAdapter sda = new SqlDataAdapter(cmd);(ds,"职⼯");urce = ["职⼯"];nd();