dataset里的两个表怎么join成一个表呀
如
A1表 A2 表
id 语文 数学 id 英语 物理
1 60 70 1 80 90
2 80 78 2 88 99
怎么合并成 A3(是用C#不是用SQL语句)A3表
id 语文 数学 英语 物理
1 60 70 80 90
2 80 78 88 99
如
A1表 A2 表
id 语文 数学 id 英语 物理
1 60 70 1 80 90
2 80 78 2 88 99
怎么合并成 A3(是用C#不是用SQL语句)A3表
id 语文 数学 英语 物理
1 60 70 80 90
2 80 78 88 99
foreach(DataRow row1 in dataSet.Tables["Table1"].Rows)
{
DataRow row2 = dataSet.Tables["Table2"].NewRow();
row2["语文"] = row1["语文"];
...
dataSet.Tables["Table2"].Rows.Add(row2);
}
DataRow dr = new DataRow()
在dr里添加列,然后吧你检索出来的数据一个个写进去
DT.Columns.Add("语文");
DT.Columns.Add("数学");
DT.Columns.Add("英语");
DT.Columns.Add("物理"); DataRow Dr = DT.NewRow();
Dr[0] = txt0.Text.Trim();
Dr[1] = txt1.Text.Trim();
Dr[2] = txt2.Text.Trim();
Dr[3] = txt3.Text.Trim(); DT.Rows.Add(Dr);