Nothing special:
1. Make sure ID column is defined as primary key for the table;
2. Set ID column to be autoincrement;
3. Try to use typed dataset. To this end drag table onto form. This will create SqlConnection and SqlDataAdapter. Right-click SqlDataAdapter and choose "Generate DataSet..." option;
4. Do not allow users to modify contents of this column. DataSet and SqlDataAdapter will automatically handles inserts, updates and deletes.
5. If you need to get autoinserted value (for example, to insert it into foreign key field), to your INSERT statement add SELECT @@IDENTITY, i.e.:
INSERT INTO (...) VALUES (...); SELECT @@IDENTITY
Run this as sigle CommandText with ExecuteScalar() method of the SqlCommand object.
Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000) br>
VB (.NET) - what other language do you need in the whole Universe?...