存储过程的执行
Web
protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataSource = new SQLHelper().test("procNewsSeleteNewNew");
GridView1.DataBind();
}
SQLHelper
public DataTable test(string procName)
{
DataTable dt = new DataTable();
cmd = new SqlCommand(procName, GetConn());
//添加存储过程
cmd.CommandType = CommandType.StoredProcedure;
using (sdr = cmd.ExecuteReader(CommandBehavior.CloseConnection))
{
dt.Load(sdr);
}
return dt;
}