C# 执行存储过程

来源:互联网 发布:swf for mac 编辑:程序博客网 时间:2024/05/03 05:29

SqlConnection sqlcon = new SqlConnection("连接串");
SqlDataAdapter ada = new SqlDataAdapter();
SqlCommand sqlcom = new SqlCommand("SearchResult", sqlcon);
SqlParameter sp = new SqlParameter("@Title", "传入值");
sqlcom.CommandType = CommandType.StoredProcedure;
sqlcom.Parameters.Add(sp);
ada.SelectCommand = sqlcom;
DataSet ds = new DataSet();
ada.Fill(ds);