DataSet dataSet = new DataSet();
SqlDataAdapter dataAdapter = new SqlDataAdapter("SELECT CurrentCycle FROM Components, Aircrafts WHERE Aircrafts.IDAircraft = '" + IDAvijona + "' " +
"AND Aircrafts.IDAircraft = Components.IDAircraftFK", povezava);
dataAdapter.Fill(dataSet);
foreach (DataRow dataRow in dataSet.Tables[0].Rows)
{
if (dataRow["CurrentCycle"] != null)
{
dataRow["CurrentCycle"] = Convert.ToInt32(dataRow["CurrentCycle"]) + Convert.ToInt32(textBoxCycles.Text);
}
}
As you can see, I am doing an update on one table. But If I try to update it with commandBuilder:
SqlCommandBuilder cmb = new SqlCommandBuilder(dataAdapter); dataAdapter.Update(dataSet, "CurrentCycle");
I got an error, that multiple tables can not be updated.
What is the code then for updating multiple tables?
Do I need all 3 commands (insert, delete, update)?

New Topic/Question
Reply



MultiQuote




|