Results 1 to 2 of 2

Thread: delete record from database [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075

    delete record from database [RESOLVED]

    I'm using "e.Index.ItemIndex" to get the row number that was clicked for deletion in my datagrid. How can I obtain the primary key of the row to use in my query to delete the record from the database?
    Last edited by EyeTalion; Nov 7th, 2002 at 10:03 AM.

  2. #2

    Thread Starter
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    well, I'm going to answear my own question...hope this helps others..

    Set the DataKeyField property of the Datagrid to the name of the primary key. Then on the delete event set a variable to the index of the DataKeyField, example:

    Dim ID As Integer = CInt(MyGrid.DataKeys(CInt(e.Item.ItemIndex)))

    Then pass this variable into the query or stored procedurer.

    eye

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width