Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database linked form id field problem

Status
Not open for further replies.

p27br

Programmer
Aug 13, 2001
516
GB
hello

i am new to Visual Studio 2005.
I am trying to develop a Winforms applications based on an Sql Server database. I created a Dataset and I "drag & dropped" the dataset fields to my form. But when i add a record, the autoincrement ID field doesn't get set, so the record is not saved.
i did put the field on the form, so i don't understand what could be the problem.
any help much appreciated
 
You should not set the value of an autoincrement field in your code. By definition, an autoincrement field sets its own value as new records are added - it increments itself.


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
i'm sorry, i must have been unclear.
I don't set the autoincrement id with code.
i just put all the fields on the form, then filled out all the fields (except the id field) then tried to save, or go to next record, but an error occurs : id field does not accept Nulls
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top