SQL nextval

xpertwinner

Member
Joined
Dec 26, 2008
Messages
24
Programming Experience
Beginner
At the beginning of my program I copy the database to some objects in the program. The user then plays with those objects, adds new ones, etc. and in the end he can save the changes to the database.

I have a datasource in my project, where one of the fields in a table has autoincrement. I was wondering 3 things:

Can I insert a new row in the data set using DEFAULT in that field?
Can I get the currval and nextval?
Can I create a sequence for my own use in my VB project?
 
The whole point of the autoincrement is the auto part. The value gets generated when you insert the data and not before. If you care what the actual values are then don't use an autoincremented column.

Note also that your DataTable will generate temporary values that may or may not be the same as what eventually gets generated by the database. It's up to you to retrieve the values generated by the database after they're generated.
 

Latest posts

Back
Top