开发者

Linq to SQL - Default Insert/Update/Delete functions not present

开发者 https://www.devze.com 2022-12-30 06:29 出处:网络
Using VS2010 and SQL express 2005, Ive created a database, created a simple table, added the database to VS2010, dragged the table i wish to query into a new \'Linq To SQL开发者_JS百科\' class.

Using VS2010 and SQL express 2005, Ive created a database, created a simple table, added the database to VS2010, dragged the table i wish to query into a new 'Linq To SQL开发者_JS百科' class.

Now, selecting works as expected - totally great.

However it has not generated the Remove() method, mydb.SumbitChanges() does nothing after amending a retrieved object, so I have obviously missed a vital step.

I have not defined anything to do updating or removing, but assumed it did this 'out the box'.

Can anyone offer any insight?


Here is a link how you do insert, update and delete:

http://msdn.microsoft.com/de-de/library/bb386931.aspx


Resolved - I had not set a primary key on the table.

0

精彩评论

暂无评论...
验证码 换一张
取 消