你把这个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();

解决方案 »

  1.   

    将select的结果放在DataSet中,假设为oDs;
    this.DataGrid1.DataSource=oDs.Tables[0].DefaultView;
    this.DataGrid1.DataBind();
      

  2.   

    lansluo(最后一个女巫) 已经快一步解答了:-)
      

  3.   

    把从数据库中取出的记录存入一个DataTable中,然后将该DataGrid的DataSource设为该DataTable,再用MyDataGrid.DataBind()就行了。
      

  4.   

    这很正常啊,有问题吗?
    将DATASET绑到DATAGRID中就可以。