PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET CommandBuilder Problem

Reply

CommandBuilder Problem

 
Thread Tools Rate Thread
Old 26-08-2003, 02:34 PM   #1
Joao Santa Barbara
Guest
 
Posts: n/a
Default CommandBuilder Problem


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


  Reply With Quote
Old 26-08-2003, 02:50 PM   #2
William Ryan
Guest
 
Posts: n/a
Default CommandBuilder Problem

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
>
>
>.
>

  Reply With Quote
Old 26-08-2003, 03:09 PM   #3
Joao Santa Barbara
Guest
 
Posts: n/a
Default Re: CommandBuilder Problem

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
>
>
>.
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off