conn.Open();
SqlCommand comm1 = new SqlCommand("select * from admin where Label = 1",conn);
SqlCommand comm2 = new SqlCommand("select * from admin where Label = 2",conn);
SqlCommand comm3 = new SqlCommand("select * from admin where Label = 3",conn);
SqlCommand comm4 = new SqlCommand("select * from admin where Label = 4",conn);
SqlCommand comm5 = new SqlCommand("select * from admin where Label = 5",conn);
SqlCommand comm6 = new SqlCommand("select * from admin where Label = 6",conn);
SqlDataReader ds1 = comm1.ExecuteReader();
DataGrid1.DataSource = ds1;
DataGrid1.DataBind();
ds1.Close();
SqlDataReader ds2 = comm2.ExecuteReader();
DataGrid2.DataSource = ds2;
DataGrid2.DataBind();
ds2.Close();
SqlDataReader ds3 = comm3.ExecuteReader();
DataGrid3.DataSource = ds3;
DataGrid3.DataBind();
ds3.Close();
SqlDataReader ds4 = comm4.ExecuteReader();
DataGrid4.DataSource = ds4;
DataGrid4.DataBind();
ds4.Close();
SqlDataReader ds5 = comm5.ExecuteReader();
DataGrid5.DataSource = ds5;
DataGrid5.DataBind();
ds5.Close();
SqlDataReader ds6 = comm6.ExecuteReader();
DataGrid6.DataSource = ds6;
DataGrid6.DataBind();
ds6.Close();
conn.Close();
这是Page_Load事件
SqlCommand comm1 = new SqlCommand("select * from admin where Label = 1",conn);
SqlCommand comm2 = new SqlCommand("select * from admin where Label = 2",conn);
SqlCommand comm3 = new SqlCommand("select * from admin where Label = 3",conn);
SqlCommand comm4 = new SqlCommand("select * from admin where Label = 4",conn);
SqlCommand comm5 = new SqlCommand("select * from admin where Label = 5",conn);
SqlCommand comm6 = new SqlCommand("select * from admin where Label = 6",conn);
SqlDataReader ds1 = comm1.ExecuteReader();
DataGrid1.DataSource = ds1;
DataGrid1.DataBind();
ds1.Close();
SqlDataReader ds2 = comm2.ExecuteReader();
DataGrid2.DataSource = ds2;
DataGrid2.DataBind();
ds2.Close();
SqlDataReader ds3 = comm3.ExecuteReader();
DataGrid3.DataSource = ds3;
DataGrid3.DataBind();
ds3.Close();
SqlDataReader ds4 = comm4.ExecuteReader();
DataGrid4.DataSource = ds4;
DataGrid4.DataBind();
ds4.Close();
SqlDataReader ds5 = comm5.ExecuteReader();
DataGrid5.DataSource = ds5;
DataGrid5.DataBind();
ds5.Close();
SqlDataReader ds6 = comm6.ExecuteReader();
DataGrid6.DataSource = ds6;
DataGrid6.DataBind();
ds6.Close();
conn.Close();
这是Page_Load事件
解决方案 »
- 请高手指点一下
- 未能加载程序集“App_Web_default.aspx.cdcab7d2”。请确保在访问该页之前已经编译了此程序集。
- 急急。。特别急。。。URL 在ISS上怎么映射
- 框架传值问题,急用!
- 对这个问题已经无语了。希望大家能帮助解决下。哎。/
- 问一下如何跟据日期生成一个固定格式的字符串??急在线等您好的回答
- 提供一个ASP.NET的搜索程序和新闻信息管理采集程序!
- 提问:关于窗体验证的问题!根文件夹和子文件夹下的设置
- ASP.NET生成静态页面,标签替换方法 列表要怎么生成静态,求指教
- 小弟要作个基于.net技术的论坛,要求处理大规模并发访问.十分注重性能
- 更菜的问题,关于存储过程的
- 那位大哥有asp.net语法支持文件——————————
行 46: DataGrid3.DataSource = ds3;错了,DataGrid 的数据源不能是DataReader