System.Data.DataTable dstab=new System.Data.DataTable();
System.Data.DataTable dstabdet=new System.Data.DataTable();
System.Data.SqlClient.SqlConnection sqlconn = new System.Data.SqlClient.SqlConnection(sqlconnstr);
System.Data.SqlClient.SqlCommand sqlcmd = new System.Data.SqlClient.SqlCommand(sql_master, sqlconn);
System.Data.SqlClient.SqlDataAdapter sqlad = new System.Data.SqlClient.SqlDataAdapter();
System.Data.SqlClient.SqlCommand sqlcmd_detail = new System.Data.SqlClient.SqlCommand(sql_detail, sqlconn);
System.Data.SqlClient.SqlDataAdapter sqlad_detail = new System.Data.SqlClient.SqlDataAdapter();
sqlcmd.CommandText = sqlstr;
sqlcmd.Connection = sqlconn;
sqlad.SelectCommand = sqlcmd;
sqlad.Fill(dstab); sqlcmd_detail.CommandText = sqlstr_detail;
sqlcmd_detail.Connection = sqlconn;
sqlad_detail.SelectCommand = sqlcmd_detail;
sqlad_detail.Fill(dstabdet); ds.Tables.Add(dstab);
ds.Tables.Add(dstabdet); ds.Relations.Add("masterdetail", ds.Tables[0].Columns[keyword], ds.Tables[1].Columns[keyword]);
dataGrid1.DataSource = ds.Tables[0].DefaultView;
System.Data.DataTable dstabdet=new System.Data.DataTable();
System.Data.SqlClient.SqlConnection sqlconn = new System.Data.SqlClient.SqlConnection(sqlconnstr);
System.Data.SqlClient.SqlCommand sqlcmd = new System.Data.SqlClient.SqlCommand(sql_master, sqlconn);
System.Data.SqlClient.SqlDataAdapter sqlad = new System.Data.SqlClient.SqlDataAdapter();
System.Data.SqlClient.SqlCommand sqlcmd_detail = new System.Data.SqlClient.SqlCommand(sql_detail, sqlconn);
System.Data.SqlClient.SqlDataAdapter sqlad_detail = new System.Data.SqlClient.SqlDataAdapter();
sqlcmd.CommandText = sqlstr;
sqlcmd.Connection = sqlconn;
sqlad.SelectCommand = sqlcmd;
sqlad.Fill(dstab); sqlcmd_detail.CommandText = sqlstr_detail;
sqlcmd_detail.Connection = sqlconn;
sqlad_detail.SelectCommand = sqlcmd_detail;
sqlad_detail.Fill(dstabdet); ds.Tables.Add(dstab);
ds.Tables.Add(dstabdet); ds.Relations.Add("masterdetail", ds.Tables[0].Columns[keyword], ds.Tables[1].Columns[keyword]);
dataGrid1.DataSource = ds.Tables[0].DefaultView;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货