tags:

views:

127

answers:

3

hi.

I have a table whit 2 columns , ID and name .I set 'YES' Identity for ID column .

I want to insert data to table whit LINQ .I want to get only name column from user in my application , and then ID column fill automatic to database and I can't give data that column and fill whitout I give it .

What should I do ?

I write in c# and work whit LINQ .

A: 

If you used the DBML designer, that should be setup correctly.

The 'id' will be populated after you call SubmitChanges.

leppie
How do I do this work?it is my problem that I can't do that.
mohammad reza
A: 

Make sure your database table is setup correctly and that your ID is set as the primary key field and to auto increment. Regenerate your DBML if you need to by deleting the object and re-adding it. It should know that the ID is not needed adn the auto fill it once the insert has succeeded.

Kelsey
A: 
marc_s