A
Andreas Nimptsch
Hi,
i have a DataSet with 3 Tables. For each table i have
defined a SqlDataAdapter Object. The SqlCommands for
Deleting, Inserting und Updating were created by the
SqlCommandBuider Object. I have wrote the following Code,
to write the Content DataSet.
public void WriteData()
{
SqlCommandBuilder buildCmd1;
SqlCommandBuilder buildCmd2;
SqlCommandBuilder buildCmd3;
buildCmd1 = new SqlCommandBuilder(this.adapter1);
buildCmd2 = new SqlCommandBuilder(this.adapter2);
buildCmd3 = new SqlCommandBuilder(this.adapter3);
this.sqlConn.Open();
this.adapter1.Update(this.dataSet, table1);
this.adapter2.Update(this.dataSet, table2);
this.adapter3.Update(this.dataSet, table3);
this.sqlConn.Close();
}
Now i want to encapsulate the three Updates in one
Transaction? How can i assign the dynamic generated
SqlCommand Objects to a SqlTransaction Object?
Thanks
Andreas
i have a DataSet with 3 Tables. For each table i have
defined a SqlDataAdapter Object. The SqlCommands for
Deleting, Inserting und Updating were created by the
SqlCommandBuider Object. I have wrote the following Code,
to write the Content DataSet.
public void WriteData()
{
SqlCommandBuilder buildCmd1;
SqlCommandBuilder buildCmd2;
SqlCommandBuilder buildCmd3;
buildCmd1 = new SqlCommandBuilder(this.adapter1);
buildCmd2 = new SqlCommandBuilder(this.adapter2);
buildCmd3 = new SqlCommandBuilder(this.adapter3);
this.sqlConn.Open();
this.adapter1.Update(this.dataSet, table1);
this.adapter2.Update(this.dataSet, table2);
this.adapter3.Update(this.dataSet, table3);
this.sqlConn.Close();
}
Now i want to encapsulate the three Updates in one
Transaction? How can i assign the dynamic generated
SqlCommand Objects to a SqlTransaction Object?
Thanks
Andreas