D
DG
I have two SqlTableAdapters (for typed dataset, generated by VS) and want to
do update of tables.
In transaction of course.
How to do it?
i try:
SqlConnection conn = new SqlConnection(Global.ConnectionString);
DSTableAdapters.Table1Adapter ta1 = new DSTableAdapters.Table1Adapter ();
DSTableAdapters.Table2Adapter ta2 = new DSTableAdapters.Table2Adapter ();
conn.Open();
trans = conn.BeginTransaction();
ta1.Connection = conn;
ta1.Connection = conn;
ta1.Update(DS.Table1);
I get an exception:
ExecuteReader requires the command to have a transaction when the connection
assigned to the command is in a pending local transaction. The Transaction
property of the command has not been initialized.
Thank you!
do update of tables.
In transaction of course.
How to do it?
i try:
SqlConnection conn = new SqlConnection(Global.ConnectionString);
DSTableAdapters.Table1Adapter ta1 = new DSTableAdapters.Table1Adapter ();
DSTableAdapters.Table2Adapter ta2 = new DSTableAdapters.Table2Adapter ();
conn.Open();
trans = conn.BeginTransaction();
ta1.Connection = conn;
ta1.Connection = conn;
ta1.Update(DS.Table1);
I get an exception:
ExecuteReader requires the command to have a transaction when the connection
assigned to the command is in a pending local transaction. The Transaction
property of the command has not been initialized.
Thank you!