Try:
建立一个DataTable1,对应于A表;
用sql语句从 B 表中检索出数据;
再将检索出的纪录加到DataTable1中;(利用DataRow和DataColumn)
设置datagrid的数据源为DataTable1;
重新绑定datagrid;
建立一个DataTable1,对应于A表;
用sql语句从 B 表中检索出数据;
再将检索出的纪录加到DataTable1中;(利用DataRow和DataColumn)
设置datagrid的数据源为DataTable1;
重新绑定datagrid;
如下:
insert into a(aa,ab,....) select aa,ab,...)
其中两个中的字段数据必须相等,把你的过滤条件放在select 语句的where 条件中,
然后执行成功后,你再重新生成数据集,然后绑定DataGrid就可以啦
string sqlconn = System.Configuration.ConfigurationSettings.AppSettings ["DBConnStr"];
SqlConnection myConnection = new SqlConnection(sqlconn);
SqlDataAdapter daCurSource = new SqlDataAdapter(sJydd,myConnection);
Dataset2 ds = new Dataset2();
daCurSource.Fill(ds,"JYDDJB");DataGrid1.DataSource = ds;
DataGrid1.DataBind();
帮我看看那里不对。现在没有数据显示。
DataGrid1.DataBind();
改为
DataGrid1.DataSource = ds.Table[0];
或者
DataGrid1.DataSource = ds.Table[""];
或者
DataGrid1.SetDataBinding(DsCustomers1, "Customers");
DsCustomers1是一个dataset Customers是一个表名
或者
DataGrid1.SetDataBinding(DsCustomers1, 0);