|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DataAdapter UpdateIf a DataAdapter.Update fails mid-way through the dataset, are earlier
updates rolled back or how is this handled? For example, let's say I am a dummy and I create a dataset without setting a unique key constraint. Then I try to do an update on the underlying database. It would fail on the records with duplicates in the unique key field. What is the state of my database at that time? I Hope that question makes sense. TIA John JL,
Did you know that today is a msdn. chat about ADONET, on your question are a lot of answers possible. One of those. http://support.microsoft.com/default.aspx?scid=kb;en-us;316024 I hope this helps Cor Thank you Cor and Abelardo,
I think using a connection transaction is my best approach. John On Tue, 29 Mar 2005 19:42:05 +0200, "Cor Ligthert" <notmyfirstn***@planet.nl> wrote: Show quote >JL, > >Did you know that today is a msdn. chat about ADONET, on your question are a >lot of answers possible. One of those. > >http://support.microsoft.com/default.aspx?scid=kb;en-us;316024 > >I hope this helps > >Cor > Hello JL,
As Cor said, there are multiple answers to this question. I noticed you posted on one of my topics and you mentioned, I am too building a Data Access Layer and I am coming up with this types of questions myself. As a matter of fact, I posted "Updating DataSets 2nd Part" because of the very same issue you are asking about. What I am trying to do in my DAL is returning the same DataSet I receive to update, but marking the DataRows which did not successfully updated back to the DataSource. For instance, in your example, my DAL would return the same dataset, but the record missing the field would have a message on the filed RowError and the flag HasError would return true. Take a look at: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdataoledboledbdataadapterclassrowupdatedtopic.asp specially at the RowUpdated event handling. This is just one way of dealing with this situations. Hope this helps. Show quote :) "J L" wrote: > If a DataAdapter.Update fails mid-way through the dataset, are earlier > updates rolled back or how is this handled? > > For example, let's say I am a dummy and I create a dataset without > setting a unique key constraint. Then I try to do an update on the > underlying database. It would fail on the records with duplicates in > the unique key field. What is the state of my database at that time? I > > Hope that question makes sense. > > TIA > John > |
|||||||||||||||||||||||