Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cancelling database updates? "cancelupdate"?

Status
Not open for further replies.

LGTOserv

IS-IT--Management
Aug 20, 2001
25
US
Hi All;

new to vb2005... i want to cancel an update to a database and discard changes. Used to initiate the "CancelUpdate" method in VB6 but it doesn't work in vb2005. What is the equivalent in 2005 ? only thing i could find was dispose()

thanks in advance.
 
In VB6 using ADO, the connection to the database was kept open so that if you made any changes to a record, those changes would be posted immediately to the database when you called EndEdit (or whatever the method was called, I can't remember right now). In ADO .NET, all of the data objects you work with (e.g., dataset, datatable, etc.) are disconnected. That is, once data are retrieved from the database, the connection is closed. Any changes you make to the in-memory data objects do not get sent to the database until you, the programmer, explicitly call the dataadapter's Update method (or call ExecuteNonQuery on a Command object). Thus, if you wish to discard any changes, simply don't call the Update method and none of the changes will be kept. You do need to clear the changes, and you can do that by calling Dispose on the dataset/datatable, or you can use the Clear method to remove all of the data.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top