471,610 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,610 software developers and data experts.

SqlCommandBuilder + transaction

DG
I use this code:

_adapter = new SqlDataAdapter(selectString, _conn);
_adapter.SelectCommand = new SqlCommand(selectString, _conn);
_adapter.SelectCommand.Transaction = _trans;
_builder = new SqlCommandBuilder(_adapter);
_adapter.Update(dt);

i get exception:
Execute requires the command to have a transaction object when the
connection assigned to the command is in a pending local transaction. The
Transaction property of the command has not been initialized.

Now, it worked on other DB! (!?).

Also:
after:
_builder = new SqlCommandBuilder(_adapter);
_adapter.UpdateCommand , InsertCommand & DeleteCommands are null !!??, so i
can't check if Transaction property is set or not. (same thing on other DB
but update works there)
SqlCommand builder uses Transaction from SelectCommand, so there sould not
be problem.

It works OK without transaction.

Any ideas?
Thanx.
Feb 6 '06 #1
0 2525

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Avanish Pandey | last post: by
5 posts views Thread by microsoft.private.windows.netserver.setup | last post: by
4 posts views Thread by Jim Reynolds | last post: by
reply views Thread by Tony Johansson | last post: by
1 post views Thread by Tony Johansson | last post: by
reply views Thread by MichaelMortimer | last post: by
reply views Thread by CCCYYYY | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.