DataTables and autoincrement on primary keys

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
[email protected]
Posts: 38
Joined: Tue 07 Mar 2006 17:13

DataTables and autoincrement on primary keys

Post by [email protected] » Wed 29 Mar 2006 19:40

I'm getting very strange problems with the MySQLDataTable (3.5 beta) working with simple primary keys.

I have a simple table with a primary key called 'ID' which is non-null autoincrementing integer. I create a row manually using the db editor. Now I write a simple program that does a "SELECT * FROM mytable".

I add a row in code, and go to update. It comes back with an error because the MySQLDataTable component is not incrementing the primary key 'ID' to 2, and in instead trying to use 1.

Another scenario:

I have a table with 100 records, again a primary key of 'ID'. I run a query "SELECT * FROM mytable WHERE field1 = 'xxx'" which returns records #'d 30-40.

I try to add a row to the resulting datatable. It fails because it is trying to use a primary key value of '41'.

Anybody else run into this problem. The MySQLDataTable is a dream for fast coding when it works, but these problems are unacceptable for using it.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 30 Mar 2006 09:06

Could you please provide us with your code sample that generates the error.

[email protected]
Posts: 38
Joined: Tue 07 Mar 2006 17:13

Post by [email protected] » Thu 30 Mar 2006 14:12

Please disregard the second scenario. Oleg has code samples from the first scenario and I believe was able to recreate the problem on his end.

Post Reply