C# 获取一个文本框来填充两个不同的表
我到处都找过这个,但我找不到任何人来做这个。我应该为此编写一个查询吗?如果不是,这里是我的代码,适用于第一个表,但不适用于第二个表:C# 获取一个文本框来填充两个不同的表,c#,sql-server-2008,C#,Sql Server 2008,我到处都找过这个,但我找不到任何人来做这个。我应该为此编写一个查询吗?如果不是,这里是我的代码,适用于第一个表,但不适用于第二个表: DataRow row = ds.Tables[0].NewRow(); DataRow row2 = ds2.Tables[0].NewRow(); row[1] = DateText.Text; //This adds all the datapoints to a Temperary table
DataRow row = ds.Tables[0].NewRow();
DataRow row2 = ds2.Tables[0].NewRow();
row[1] = DateText.Text; //This adds all the datapoints to a Temperary table
row[2] = IPNText.Text;
row[3] = MoldText.Text;
row[4] = MachineText.Text;
row[5] = StartText.Text;
row[6] = EndText.Text;
row[7] = GoodText.Text;
row[8] = BadText.Text;
row2[1] = DateText.Text;
row2[2] = IPNText.Text;
row2[3] = MachineText.Text;
row2[4] = MoldText.Text;
row2[8] = GoodText.Text + BadText.Text;
ds.Tables[0].Rows.Add(row); //This adds a row to Production Report Data Table
ds2.Tables[0].Rows.Add(row2);
try //Officially adds the data to the last row of Production Report Data Table
{
objConnect.UpdateDatabase(ds);
MaxRows = MaxRows + 1; //Keeps track that we are updating the fact that our max rows has changed
objConnect2.UpdateDatabase(ds2);
MaxRows2 = MaxRows2 + 1;
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}