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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mdbi
    New Member
    • Sep 2010
    • 2

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

    i have not declared any primary key of table and I want to delete row using gridview or formview. Is it possible?
  • veenna
    New Member
    • Dec 2007
    • 65

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

    regards,
    veena

    Comment

    • mdbi
      New Member
      • Sep 2010
      • 2

      #3
      thanks. But can you plz tell me how I can do this. I have tried much but it was not working. Plz help me.

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        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:
        Code:
        DELETE FROM Persons
        WHERE FirstName='John' 
              AND MiddleName='Jayne'
              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)

        -Frinny

        Comment

        Working...