Add new record - Autonumber issue

Cajunspirit

Member
Joined
Sep 29, 2008
Messages
19
Programming Experience
Beginner
So my first project could add new records just peachy, but I messed around with core code too much and it crashed.

Essentially I used the add new record code from the msdn library, It only works if I remove the Primary key for the UID from the dataset.

However, this in turn causes the TableAdapter to effectively loose it's Update function. It was not really an issue at the time but it was annoying to have that one build error. In trying to fix this I ultimately lost the whole damn system.

Right.. I'm back at this point and new records will add but the associated information for the record is not.
How do I let the Database generate the autonumber for my new records?
 
The Dataset for the UID has the primary key as

AllowDBNull = False

DefaultValue = <DBNull>

Now this is clearly a contradiction!
What do I set DefaultValue to, so that the DB automatically generates the UID???
 
You'd also set the autonumber/increment/seed/step options, and then have the tableadapter populate a proper ID back into the dataset during a Update() op. See my other thread to you on this topic
 
Back
Top