SQLHelper 如何调用存储过程~最好有例子,谢谢!
strcon="....";SqlParameter[]sp=newsqlParameter[5];......DataSetds=SqlHelper.ExecuteDa...
strcon="....";
SqlParameter[] sp = new sqlParameter[5];
...
...
DataSet ds=SqlHelper.ExecuteDataset(strConnection,CommandType.StoredProcedure,"P1",sp);
this.dgrPrdMtl.SetDataBinding(ds,"tables");
中间应该怎么写?怎么加参数?谢谢大家! 展开
SqlParameter[] sp = new sqlParameter[5];
...
...
DataSet ds=SqlHelper.ExecuteDataset(strConnection,CommandType.StoredProcedure,"P1",sp);
this.dgrPrdMtl.SetDataBinding(ds,"tables");
中间应该怎么写?怎么加参数?谢谢大家! 展开
2个回答
展开全部
SqlCommand comd = new SqlCommand();
comd.Connection = conn;
comd.CommandText = "存储过程名";
comd.CommandType = CommandType.StoredProcedure;
//附加到存储过程的参数;@product存储过程中的参数;product要附加的参数,比方说textbox1.text;;
SqlParameter para1 = comd.Parameters.AddWithValue("@product",product);
comd.Connection = conn;
comd.CommandText = "存储过程名";
comd.CommandType = CommandType.StoredProcedure;
//附加到存储过程的参数;@product存储过程中的参数;product要附加的参数,比方说textbox1.text;;
SqlParameter para1 = comd.Parameters.AddWithValue("@product",product);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询