各位高手帮我看看这段代码,我想调用存储过程,为什么运行后在GridView中不显示数据 conn.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
SqlCommand mycommand = new SqlCommand();
mycommand.Connection = conn;
mycommand.CommandText = "存储练习_2";
mycommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand = mycommand;
da.Fill(ds);
this.GridView2.DataSource = ds.Tables[0];
this.GridView2.DataBind();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter();
SqlCommand mycommand = new SqlCommand();
mycommand.Connection = conn;
mycommand.CommandText = "存储练习_2";
mycommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand = mycommand;
da.Fill(ds);
this.GridView2.DataSource = ds.Tables[0];
this.GridView2.DataBind();
一直不知道这个错在哪里```不显示啊``
{
SqlCommand cmd = new SqlCommand("存储练习_2",conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter dp = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
dp.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}
查询分析中执行