展开全部
string connstr = ConfigurationManager.ConnectionStrings["adventureWorks"].ConnectionString;
DataSet ds,ds1;
using (SqlConnection conn = new SqlConnection(connstr))
{
string sql = "select * from ContactType";
string sql1= "select * from News";
ds = new DataSet();
ds1=new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
SqlDataAdapter adapter1=new SqlDataAdapter(sql1,conn);
adapter.Fill(ds);
adapter1.Fill(ds1);
ds.Merge(ds1);
}
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
DataSet ds,ds1;
using (SqlConnection conn = new SqlConnection(connstr))
{
string sql = "select * from ContactType";
string sql1= "select * from News";
ds = new DataSet();
ds1=new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter(sql, conn);
SqlDataAdapter adapter1=new SqlDataAdapter(sql1,conn);
adapter.Fill(ds);
adapter1.Fill(ds1);
ds.Merge(ds1);
}
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询