Hi,

I am writting a program using VB.Net to connect to a MSSQL Server 2000 database by ADO.Net technology. My database has four tables, namely "Patients", "Lesions", "Measurements" and "Files". They are all in a series of "one to many" relations.For example, one patient can have multiple lesions and one lesion can have multiple measurements and one measurement
can have multiple files. I use auto increment integer number as the "id"s of table "Lesions", Measurements", "files", and set their seeds and as "identical".

I have a problem to add a new record for the tables with auto increment numbers as their "id"s. Whenever I called the addNew() meathod to add a new record to, for exampel, the "Lesions" table, the number of "id" shown is always a number larger than it should be. In my case, it's always two more than it should be in the "Lesions" table, for example, I already have 3 records with "id" 0, 1, 2, in the table, the next (new) one I add should be with "id" 3, but it actually comes up with "id" 5. Then this conflicts with the table so if I update the data adaptor, there are two new records shown up, one with "id" 3, the other with "id" 5. Of course the one with "id" 5 is invalid, so any work with it will end up with an error. I have to close the form and restart it, then the devil record with "id" 5 disappear, and everything now is OK.

Can somebody please give me some hint to solve this problem? It's a real time killer for me.

And I also noticed there is a post with same problem marked with solved, but there was simply no reply to the thread.

Thank you,

adHeadache