Click here to Skip to main content
15,913,570 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can insert values in to a table using linq, without a primary key??
Is it possible???
Plz help me..
Thanx in advance....
Posted
Updated 20-Oct-11 19:13pm
v2

 
Share this answer
 
Comments
RaisKazi 20-Oct-11 5:20am    
Agree. At the same time, Twice today. :)
abintj 20-Oct-11 5:31am    
what is the exact reason of this problem(cannot insert without a primary key)??
Mehdi Gholam 20-Oct-11 5:37am    
LINQ uses the primary key for fetching and updating without it, it would not know which record to update or fetch etc.
BobJanova 20-Oct-11 5:57am    
That shouldn't stop it inserting, though. Insertion doesn't require a key.
Mehdi Gholam 20-Oct-11 6:14am    
How can it tell it is inserting or updating without a primary key?
I doubt, if you can achieve this. Below link has similar discussion.

http://stackoverflow.com/questions/333228/linq-insert-with-no-primary-key
 
Share this answer
 
Comments
Mehdi Gholam 20-Oct-11 5:19am    
Hehe! we pasted the same! 5!
 
Share this answer
 
v2
Comments
Anuja Pawar Indore 20-Oct-11 7:09am    
Refer this thread for answer why we cant update without primary key
http://www.i-think22.net/archives/2009/07/24/linq-to-sql-and-tables-with-no-primary-key/

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900