I have a Table in which i don’t want to specify any primary key, after that i am inserting records in it using Linq…aahhh…its giving the error
“Can’t perform Create, Update or Delete operations on ‘Table(abc)’ because it has no primary key”
can ani one tell me how to insert record without setting it primary key.
By the way im not setting any primary key because this table will have bulk of data to keep.
You can’t use Linq-to-SQL directly with tables that don’t have primary keys, because it’s not supported.
If you’re worried about the performance hit of indexing, what you can do is add a Stored Procedure that does the insert and add that to your data context. It’s a bit more work, and it’s not really Linq-to-SQL, it’ll just be a method on that you call on your data context.
There probably won’t be a noticeable performance hit on an identity primary key field anyway.