Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Advice required about sqlconnection
Message
From
23/05/2004 23:57:32
 
 
To
23/05/2004 23:50:13
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00906377
Message ID:
00906386
Views:
20
This message has been marked as the solution to the initial question of the thread.
I do that as a transaction while the connection is open.

For instance (and there's more code than just this, but here's a quick example)

MyConnection = GetSqlConnection(sConnectionString);
MyConnection.Open();
MyCommand = new SqlCommand();
MyTransaction = MyConnection.BeginTransaction();
MyCommand.Transaction = MyTransaction;

// code for the update


// if the update is good...
MyTransaction.Commit();

// if the update didn't work (some kind of error)

catch(Exception e)
{
MyTransaction.Rollback();
}

/// and then close

MyConnection.Close();
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform