PC Review
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
CommandBuilder Problem
Forums
Newsgroups
Microsoft DotNet
Microsoft ADO .NET
CommandBuilder Problem
![]() |
CommandBuilder Problem |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi all
i have a problem with my command builder i have made a commandbuild to get the insert, delete and update querys. i´m using a table with a autonumber, so i have fill my dataset with this query select * from test_table1 this table has 3 fields ID ( autonumber) Code( Varchar) Description(Varchar) so after i have inserted a new row, i update the database, and in the same row i change a value ( ex description ) and save it again it throws a exception "Concurrency violation " i know that the problem is in the autonumber but i don´t want to make all querys by hand . how can i solve this ... thks JSB |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Try setting the autoincrement value of the PrimaryKey
column to -1. If you are using an autonumber, it's possible that it's value is the same as the one the DB is tryting to add, by using a negative number, that won't happen and it'll be assigned correctly in the db. Good Luck, Bill >-----Original Message----- >Hi all >i have a problem with my command builder > >i have made a commandbuild to get the insert, delete and update querys. >i´m using a table with a autonumber, so i have fill my dataset with this >query >select * from test_table1 > >this table has 3 fields >ID ( autonumber) >Code( Varchar) >Description(Varchar) > >so after i have inserted a new row, i update the database, and in the same >row i change a value ( ex description ) and save it again it throws a >exception "Concurrency violation " > >i know that the problem is in the autonumber but i don´t want to make all >querys by hand . > > >how can i solve this ... > >thks > >JSB > > >. > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
hi there thks for the reply
but i think that the problem is not the pk column, but the refresh of the pk column i have analising the commandbuilder, and it should do after the insert a select to the inserted row asking what is the key . and the commandbuilder doesn´t do that .. thks JSB "William Ryan" <dotnetguru@cocmast.nospam.net> wrote in message news:0ddb01c36bd9$09eb59c0$a301280a@phx.gbl... Try setting the autoincrement value of the PrimaryKey column to -1. If you are using an autonumber, it's possible that it's value is the same as the one the DB is tryting to add, by using a negative number, that won't happen and it'll be assigned correctly in the db. Good Luck, Bill >-----Original Message----- >Hi all >i have a problem with my command builder > >i have made a commandbuild to get the insert, delete and update querys. >i´m using a table with a autonumber, so i have fill my dataset with this >query >select * from test_table1 > >this table has 3 fields >ID ( autonumber) >Code( Varchar) >Description(Varchar) > >so after i have inserted a new row, i update the database, and in the same >row i change a value ( ex description ) and save it again it throws a >exception "Concurrency violation " > >i know that the problem is in the autonumber but i don´t want to make all >querys by hand . > > >how can i solve this ... > >thks > >JSB > > >. > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

