我到处寻找这个,我找不到任何人这样做。我应该为此写一个查询吗?如果不是这里我的代码适用于第一个表但不适用于第二个表:
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);
}