Click here to Skip to main content
16,006,442 members
Home / Discussions / Database
   

Database

 
GeneralRe: Count total records Pin
dangdinhtien26-Dec-02 2:52
dangdinhtien26-Dec-02 2:52 
GeneralDeleting rows in disconnected dataset Pin
Ludwig Stuyck23-Dec-02 7:53
Ludwig Stuyck23-Dec-02 7:53 
GeneralRe: Deleting rows in disconnected dataset Pin
Mazdak23-Dec-02 8:08
Mazdak23-Dec-02 8:08 
GeneralRe: Deleting rows in disconnected dataset Pin
Ludwig Stuyck23-Dec-02 9:24
Ludwig Stuyck23-Dec-02 9:24 
GeneralRe: Deleting rows in disconnected dataset Pin
Mazdak23-Dec-02 9:42
Mazdak23-Dec-02 9:42 
GeneralRe: Deleting rows in disconnected dataset Pin
Ludwig Stuyck23-Dec-02 10:07
Ludwig Stuyck23-Dec-02 10:07 
GeneralRe: Deleting rows in disconnected dataset Pin
Nick Seng26-Dec-02 23:17
Nick Seng26-Dec-02 23:17 
GeneralRe: Deleting rows in disconnected dataset Pin
lustuyck27-Dec-02 3:47
lustuyck27-Dec-02 3:47 
Well, I found the reason.

When a new row is inserted in my dataset at client side, the autonumber column for that row receives a number that is equal to the previous rownumber + 1, for example 10.

The dataset is then sent to the server, where it is written back to the database. However, the autonumber of the new row in the database is not always the previous autonumber + 1, for example if you previously deleted the last row in the database. In this example, it will be 11.

At this point, the dataset at client side and the database rows are not consistent anymore.

Solution: after the database has been updated, the updated dataset has to be sent back to the client. But first, the autonumber column of the new row has to be adjusted to the real database autonumber (by using the RowUpdated event handler).

At client side, the new row at the original client dataset is first purged; then it is merged with the new dataset coming from the server, and then AcceptChanges() is called.

After this, the client dataset is equal to the database rows, and concurrency violation won't occur.

Eek! | :eek: It was a day work to find this one Unsure | :~
GeneralRe: Deleting rows in disconnected dataset Pin
Nick Seng27-Dec-02 14:21
Nick Seng27-Dec-02 14:21 
GeneralPaging in ADO.NET Pin
vasily23-Dec-02 0:31
vasily23-Dec-02 0:31 
GeneralRe: Paging in ADO.NET Pin
leppie23-Dec-02 6:08
leppie23-Dec-02 6:08 
GeneralNewbie needs help Pin
Benjamin Ng22-Dec-02 16:58
Benjamin Ng22-Dec-02 16:58 
GeneralRe: Newbie needs help Pin
Paul Ingles23-Dec-02 1:37
Paul Ingles23-Dec-02 1:37 
GeneralRe: Newbie needs help Pin
Tatham26-Dec-02 7:07
Tatham26-Dec-02 7:07 
GeneralSQL SELECT Question Pin
Larry Antram21-Dec-02 12:19
Larry Antram21-Dec-02 12:19 
GeneralRe: SQL SELECT Question Pin
Rein Hillmann21-Dec-02 17:23
Rein Hillmann21-Dec-02 17:23 
GeneralAutomate registering a DSN Pin
Robby20-Dec-02 4:10
Robby20-Dec-02 4:10 
GeneralRe: Automate registering a DSN Pin
Rein Hillmann20-Dec-02 6:03
Rein Hillmann20-Dec-02 6:03 
GeneralRe: Automate registering a DSN Pin
Alexander Kojevnikov22-Dec-02 2:07
Alexander Kojevnikov22-Dec-02 2:07 
GeneralRe: Automate registering a DSN Pin
mwilliamson23-Dec-02 9:44
mwilliamson23-Dec-02 9:44 
GeneralTo wrap or not to wrap... that´s the question... Pin
Mauricio Ritter19-Dec-02 0:17
Mauricio Ritter19-Dec-02 0:17 
GeneralRe: To wrap or not to wrap... that´s the question... Pin
Michael P Butler19-Dec-02 0:44
Michael P Butler19-Dec-02 0:44 
GeneralRe: To wrap or not to wrap... that´s the question... Pin
SimonS19-Dec-02 1:41
SimonS19-Dec-02 1:41 
GeneralRe: To wrap or not to wrap... that´s the question... Pin
Alexander Kojevnikov19-Dec-02 5:32
Alexander Kojevnikov19-Dec-02 5:32 
GeneralRe: To wrap or not to wrap... that´s the question... Pin
leppie19-Dec-02 7:13
leppie19-Dec-02 7:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.