Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 12, 2010 01:09 AM by PeteNet
Participant
1646 Points
924 Posts
Sep 12, 2010 12:44 AM|LINK
I hope to delete all records in DBPrograms, is the following code correct?
DBContext db = DBContext(PublicDBPar.ConnectionString); db.DBPrograms.DeleteAllOnSubmit(db.DBPrograms); db.SubmitChanges();
All-Star
81342 Points
11398 Posts
Sep 12, 2010 01:09 AM|LINK
that should work.
alternatively:
dc.ExecuteCommand("DELETE from TableName");
replace 'TableName' with your table name
Here's a good read: http://www.aneyfamily.com/terryandann/post/2008/04/Batch-Updates-and-Deletes-with-LINQ-to-SQL.aspx
mycwcgr
Participant
1646 Points
924 Posts
Is the delete records LINQ correct ?
Sep 12, 2010 12:44 AM|LINK
I hope to delete all records in DBPrograms, is the following code correct?
DBContext db = DBContext(PublicDBPar.ConnectionString);
db.DBPrograms.DeleteAllOnSubmit(db.DBPrograms);
db.SubmitChanges();
PeteNet
All-Star
81342 Points
11398 Posts
Re: Is the delete records LINQ correct ?
Sep 12, 2010 01:09 AM|LINK
that should work.
alternatively:
dc.ExecuteCommand("DELETE from TableName");
replace 'TableName' with your table name
Here's a good read: http://www.aneyfamily.com/terryandann/post/2008/04/Batch-Updates-and-Deletes-with-LINQ-to-SQL.aspx
Peter