473,322 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Is it possible to work with commandbuilder and with a Autonumber Field

Hi all i have a table with an autonumber field

with a based select , i want to get all the three others commands,

my problem is, i have a ds and i want to insert a new row ( my database
gives a new id to that row, it the pk )
after i insert the row, i have watched the DS for my ID, and i can´t find
the correct one. ( if i doesn´t find the correct one how can i make changes
to the currentrow )
what is going wrong with the CommandBuilder ...

after a have inserted the new row i try to change a column value and it
throws a concurrency exception ..

why ????

thks
JSB

PS: does anyone have a sample for this ???
Jul 19 '05 #1
2 2261
Why are you using an autonumber field if the DB is allocating the number
itself. When inserting a new row, use -1 for the PK and your db should
allocate the correct new ID and you wont get this concurrency error.

--
Regards - One Handed Man

Author : Fish .NET & Keep .NET

==============================
"Joao Santa Barbara" <jo****@i24potugal.com> wrote in message
news:Ol**************@TK2MSFTNGP12.phx.gbl...
Hi all i have a table with an autonumber field

with a based select , i want to get all the three others commands,

my problem is, i have a ds and i want to insert a new row ( my database
gives a new id to that row, it the pk )
after i insert the row, i have watched the DS for my ID, and i can´t find
the correct one. ( if i doesn´t find the correct one how can i make changes to the currentrow )
what is going wrong with the CommandBuilder ...

after a have inserted the new row i try to change a column value and it
throws a concurrency exception ..

why ????

thks
JSB

PS: does anyone have a sample for this ???

Jul 19 '05 #2
See my article on the Command builder and the identity issues at
http://www.betav.com/msdn_magazine.htm
--
____________________________________
Bill Vaughn
MVP, hRD
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Joao Santa Barbara" <jo****@i24potugal.com> wrote in message
news:Ol**************@TK2MSFTNGP12.phx.gbl...
Hi all i have a table with an autonumber field

with a based select , i want to get all the three others commands,

my problem is, i have a ds and i want to insert a new row ( my database
gives a new id to that row, it the pk )
after i insert the row, i have watched the DS for my ID, and i can´t find
the correct one. ( if i doesn´t find the correct one how can i make changes to the currentrow )
what is going wrong with the CommandBuilder ...

after a have inserted the new row i try to change a column value and it
throws a concurrency exception ..

why ????

thks
JSB

PS: does anyone have a sample for this ???

Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Joao Santa Barbara | last post by:
hi all i need to work with the commandbuilder and with a transaction object how can i do this ???? thks JSB please don´t tell me that i have to do this ex:
2
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third...
4
by: Don Seckler | last post by:
I am building an application to track the distribution and returns of copies of magazines. Copies of a magazine that are unsold are returned by the retailer to the wholesaler. They are...
21
by: Dan | last post by:
Hi, just ran into my first instance of a backend Access97 database not compacting. I'm getting the "MSACCESS.EXE has generated errors.." message on compact. I've narrowed it down to the largest...
7
by: Amy | last post by:
I'm trying to add an autoincrementing id to a table based on an existing field Name, but Name has duplicated records. How can I do that in ACCESS? Thanks. Amy
0
by: Georges Heinesch | last post by:
Hi. I have a primary key field in a table defined as AutoNumber Random. I'd like to know whether it's possible that Access the number 0 (zero) to this field? I.a.w., is 0 (zero) part of the...
1
by: Jeremy | last post by:
When executing myda.update(myds,"cert"). I get the message "The field 'Cert.DateofInspection' cannot contain a Null value because the Required property for this field is set to True. Enter a...
2
by: Joao Santa Barbara | last post by:
Hi all i have a table with an autonumber field with a based select , i want to get all the three others commands, my problem is, i have a ds and i want to insert a new row ( my database gives...
10
by: MLH | last post by:
Suppose, in a multi-user environment, you have append query SQL in a VBA procedure that looks like INSERT INTO MyTable... and the next line reads MyVar=DMax("","MyTable... You can never be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.