你把这个sql语句的查询结果放到数据集里,然后绑定datagrid不久可以了。
Sqlstr="select * from table1 union select * from table2"(
SqlConnection con = new SqlConnection(ConnectionString);
SqlDataAdapter da = new SqlDataAdapter(Sqlstr,con);
DataSet ds = new DataSet();
da.Fill(ds);this.DataGrid1.DataSource = ds;
this.DataGrid1.DataBind();
Sqlstr="select * from table1 union select * from table2"(
SqlConnection con = new SqlConnection(ConnectionString);
SqlDataAdapter da = new SqlDataAdapter(Sqlstr,con);
DataSet ds = new DataSet();
da.Fill(ds);this.DataGrid1.DataSource = ds;
this.DataGrid1.DataBind();
解决方案 »
- vb 的时间控件能不能只显示年?能不能只显示月?在线等!
- 求一个将Sql语句转换为Linq语句的工具
- GridView绑定图片
- 请教高手!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 指点迷津
- 获取DataGrid中的textbox值,放在外面的button中
- 请问我在在。NET的。ASPX中如何调用我以前写好的DLL组件?
- 关于N-tier的问题
- 菜鸟急需各位帮助
- aspx.cs 向aspx页面控件赋值后 控件还是没有值
- 上传文件。
- 请问如何在手工绑定的DataGrid中指定的位置插入一个超级链接列?
this.DataGrid1.DataSource=oDs.Tables[0].DefaultView;
this.DataGrid1.DataBind();
将DATASET绑到DATAGRID中就可以。