Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have add the data in datatable again i add the same data in this table then error msg display this data is already exitice using vb.net
Posted
Comments
Roliking 17-Apr-12 4:58am    
can you show me the code?? check if you are inserting the same data into a unique column.
Bala Selvanayagam 17-Apr-12 5:25am    
where is your code ? post your code so that we can try and help you ?
Sridhar Patnayak 17-Apr-12 7:46am    
Please explain briefly, Why you are inserting duplicate data!

1 solution

The issue may be because of Primary Key column. After adding a value of primary key column to the DataTable, if the same value is again added to the DataTable, the above error may be thrown as duplicate values are not permitted in PrimaryKey column.
 
Share this answer
 
Comments
Sridhar Patnayak 17-Apr-12 7:48am    
The problem will be the primary key only, but removing primary key is not a best practice, Good gus 5+
VJ Reddy 17-Apr-12 7:54am    
Thank you, Sridhar.
You are absolutely correct. The primary key is a must to work with ADO.NET other wise there will be problems in updating the data to the database. If the duplicate values are expected in the present primary key column, then it is good idea to introduce another column exclusively for primary key, and free the present column from primary key responsibility.
Manoj Kumar Choubey 17-Apr-12 8:26am    
I will give +5 this is sufficient answer.
VJ Reddy 17-Apr-12 10:06am    
Thank you, Manoj.

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