Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have a grid view and in this gridview 1 checkbox is there. i want to insert the data into the database of checked row of gridview. but when second time i insert 2 or 3 row with old checked row of gridview then it should skip to insert the data of old selected row and insert the data of new selected row...

please help me..

Thanks..In Advance...
Posted
Comments
George Jonsson 1-Jul-14 1:47am    
Make a list of your different use cases so you know exactly what should be done in each case.
Then you can use the DataRow property RowState to check if the row is new or updated or what.

1 solution

Before you insert, check in the DB if that record exists. If so, then dont insert the record.
 
Share this answer
 
Comments
shyam kanungo 2-Jul-14 6:16am    
sir,,
I have a grid view and in this gridview 1 checkbox is there. i want to insert the data into the database of checked row of gridview. but when second time i insert 2 or 3 row with old checked row of gridview then it should skip to insert the data of old selected row automatically and insert the data of new selected row...
George Jonsson 2-Jul-14 6:47am    
The solution doesn't really solve his problem.
I presume he wants to avoid to check in the database.
shyam kanungo 2-Jul-14 7:01am    
Exactly right sir..
I my project admin approve users from gridview using checkbox and selected users inserted into database. my problem is if in next admin checked another user to insert into database than previously checked user also inserted once again.. so i want to prevent this..
George Jonsson 2-Jul-14 7:05am    
So what you really want to do is to avoid duplicates in the database?
The number transactions are not critical.Right?
shyam kanungo 2-Jul-14 7:13am    
yaa right

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