473,326 Members | 2,805 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,326 software developers and data experts.

Autoincrement / Rowstate problems

Hi,

I'm getting some strange results using the autoincrement column on my
datatable. I'm populating a datatable with data from my database and
displaying this in a datagrid. The first time I get the data from the
database I create a new table with an autoincrement column bind the datagrid
to this new table. The auto increment column is displayed as an ID col in the
datagrid. The user can add records or modify records at this point, when the
user adds records i create a new row in the datatable and rebind the grid,
this all works fine and the autoincrement displays the next number in the ID
col. However if I make a change to the original rows that come back from the
database and then add a new record the autoincrement starts to skip numbers.
It looks like the datatable creates a copy of the original data before
modifying it but the autoincrement col is generated in between this
happening. I have verifed that it is something to do with the rowstate
because if I call AcceptChanges() and then re-generate the auto id it works
fine but I need to know the rowstate to perform my updates so I cannot use
this as a workaround.

Sorry for the long post but if anyone has any ideas pls let me know.

Thanks
N
Nov 18 '05 #1
0 1383

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

Similar topics

2
by: Phil Townsend | last post by:
I have a datagrid in a windows forms application. The datagrid gets its data via a web service. Users can modify rows in the datagrid then post their changes. However, when changes are made the...
0
by: fatboycanteen | last post by:
When I filled the db data to the dataset eg. (id_col is autoincrement) id_col field1 97 100 98 200 99 15 100 72 ---
6
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the...
6
by: astro | last post by:
I'm working through the binder stuff trying to get a handle on it... I have setup a master-detail dataset and have a couple of textboxes from the master along with a datadgrid for the child data....
6
by: timbobd | last post by:
I have a Windows form that displays a database table in a DataGrid. When you click on a row, the row's values get copied to bound TextBoxes below, and when the "Save" button is clicked the database...
3
by: MP | last post by:
context: vb6/ ado / .mdb format / jet 4.0 (not using Access - ADO only) - creating tables via ADO (don't have access) - all tables have a primary key (PK) - many of the PK will become FK(Foreign...
13
by: Dale Harris | last post by:
I'm getting really strange behaviour where the data source RowState is not being updated to modified in some circumstances. I place my controls on a form, bind them through a BindingSource control...
3
by: perspolis | last post by:
Hi all I have a master detail table which I use them in Transaction to Update them. in some cases the detail table generates error and I Rollback transaction but RowState of master table dosen't...
4
by: Tim | last post by:
Hello All, I could use some help on an error that is just now popping it's head up. Seems that the autoincrement numeric has hit 32,767. The autoincrement is used in various locations in the...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.