UID field for a new record

Cricket

Active member
Joined
Jan 6, 2005
Messages
28
Location
Hamilton, ON, Canada
Programming Experience
5-10
Since the database has an autonumber for the UID I'm having problems adding new records into a Access database. How do I do this with an DataAdapter? I realize in SQL Server you can create a Stored Procedure, but this option isn't available to Access databases.

Love to here some examples or direction on this one.
 
You can use stored procedureds in Access by creating a query and using it's name in an OleDbCommand object.

You can also simply create a command object, set its command text to the proper INSERT statement (if you leave out the autonumber field UID, the engine assigns the next number).
 
If you use typed datasets using the AutoIncrement feature of the schema, you can obtain the next autonumber value.
Also, if the autoIncrement is 1, the next value will be 1 greater than the last record. Should be pretty easy to calculate.
 
Back
Top