
Signature
Contact:
Bauman Moscow State Technical University
Russia, Moscow 105005
Tel: +7915-426-6272
ICQ: 160-223-078
YM: Chipheo2k
Hi,
> Hello,
> I have table with auto-id. Binding to a datagridview. One interesting
[quoted text clipped - 6 lines]
> to add many new rows and after that I press onto button Update it works ok
> (without any error message). Pls explain.
To support this auto-id in a batch mode, the DataColumn is set to
AutoIncrement, then when the update is performed the DB generated keys are
retrieved but *one* at a time.
So, let's say you're adding three new records:
id ...
-- ---
0 ...
1 ...
2 ...
The id's are generated by the DataColumn, now when you perform the update,
the first row is inserted in the DB and it returns 1 as the key, but the
second row currently also has 1 as the key, so it fails ...
To avoid problems, set the DataColumn's AutoIncrementStep to -1, so the id's
generated by the DataColumn are negative, while the ones generated by the DB
are positive, this to avoid dupplicate keys *while* performing the update.
To set the DataColumn's AutoIncrementStep, double click on your DataSet in
solution explorer, select the id column inside the DataSet Schema Designer
and then open properties window.
HTH,
Greetings
> thanks.
Duong Nguyen - 27 Sep 2006 10:53 GMT
Such a greate idea, thanks a lot!

Signature
Contact:
Bauman Moscow State Technical University
Russia, Moscow 105005
Tel: +7915-426-6272
ICQ: 160-223-078
YM: Chipheo2k
> Hi,
>
[quoted text clipped - 39 lines]
>
>> thanks.