VB.NET LINQ to SQL Delete All Records

Posted by Daniel on Stack Overflow See other posts from Stack Overflow or by Daniel
Published on 2010-05-06T17:42:36Z Indexed on 2010/05/06 17:58 UTC
Read the original article Hit count: 359

Filed under:
|
|
|
|

I am having problems with deleting all records in a table with VB.NET. I am using this code to delete all records in the Contacts table

        For Each contact In database.Contacts
             database.Contacts.DeleteOnSubmit(contact)
        Next

But I get this error

Can't perform Create, Update or Delete operations on 'Table(Contact)' because it has no primary key.

Anyone have any suggestions?

Thanks

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about linq-to-sql