c#中用sql存储过程
string connstr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(connstr);
SqlCommand comm = new SqlCommand();
comm.Connection = conn;
comm.CommandType = CommandType.StoredProcedure;
comm.CommandText = "sd_wish_selected";
SqlParameter[] parms={
new SqlParameter("@product_id", SqlDbType.Int,4),
new SqlParameter("@province",SqlDbType.NVarChar,20),
new SqlParameter("@city",SqlDbType.NVarChar,20),
new SqlParameter("@imei",SqlDbType.NVarChar,50)};
parms[0].Value = 34;
parms[1].Value = "|河南省|";
parms[2].Value = "郑州";
parms[3].Value = "112";
comm.Parameters.AddRange(parms);
conn.Open();
SqlDataAdapter sda = new SqlDataAdapter(comm);
DataSet ds = new DataSet();
sda.Fill(ds);
rep.DataSource = ds;
rep.DataBind();
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。