473,662 Members | 2,760 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1400

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

Similar topics

2
2164
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 rowstate remains "Added" for all the rows--those that were modified AND those that were unchanged. Here is the code I am using to test (dsitems is the underlying dataset): private void btnSave_Click(object sender, System.EventArgs e) { string...
0
827
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
16119
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 AutoIncrement Columns to different values but didn't get any errors. Should I be able to set the value of an AutoIncrement Column? I would have thought it couldn't be done as the column value was set when a row was added. -- Dennis in Houston
6
1777
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. I have a navigation pallete with the usual arrows. All arrow btn's are handled by the same handler. Before moving off the current record I do the following:
6
11277
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 is updated (as is the DataGrid row) with changed values in the TextBoxes. Here are some observations: 1) When changes are typed into a text box and "Save" is clicked, the changes are reflected in the DataSet.Tables().Rows().ItemArray value, but...
3
3036
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 Key) in other table(s) - record entries will be made via ADO I am soliciting opinions on the pros and cons of using AUTOINCREMENT versus code generated GUID or LONG value (as far as my limited understanding goes, if I enter a record, and need...
13
11804
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 to a DataSet. If I don't do anything to the DataSet other than load data normally through TableAdapters everything works fine. If I load a table(static data for ComboBox) in the DataSet manually; the DataSet now says it has changes. I call...
3
2264
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 go back to previous state and no data has entered in database yet but in my master table in memory it has data.. ???? how can I change RowState of master table to previous RowState before begining Save. thanks in advance
4
2449
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 database, but in this case (log sheets), we have hit 32k log entries over the past 2 years. Is there a simple switch to set the autoincrement from integer to long integer?
0
8768
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7368
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4348
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1999
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.