By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

I have not declare any primary key of the table and I want to delete row using gridvi

P: 2
i have not declared any primary key of table and I want to delete row using gridview or formview. Is it possible?
Sep 12 '10 #1
Share this Question
Share on Google+
3 Replies

P: 65
Its possible with out setting primary key also. but you should have a unique value column in the table.

Sep 13 '10 #2

P: 2
thanks. But can you plz tell me how I can do this. I have tried much but it was not working. Plz help me.
Sep 14 '10 #3

Expert Mod 5K+
P: 9,731
You need to find the row that matches the one that the user selected to delete. Use the SQL "WHERE" Clause to help you with this.

For example, if a First Name, Middle Name and Last Name makes a unique key to identify someone you could have something like:
Expand|Select|Wrap|Line Numbers
  1. DELETE FROM Persons
  2. WHERE FirstName='John' 
  3.       AND MiddleName='Jayne'
  4.       AND LastName='Doe' 
You may need to use more than 3 fields to ensure that you are deleting the right record...this is why unique identifiers are easier to use (as veenna suggested)

Sep 14 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.