C
Chris Kennedy
I want to delete a specific record in a dataset based on its primary key
which I can get from a the value of a dropdown menu. I tried using the
select method to filter the datatable on the primary key and as this table
should only contain 1 record I should be deleting the right record. It
still, however, deletes the first record in the dataset not the filtered
table. Can anyone help. Some pointers to code examples would be great as
ADO.net is a real weak point. Regards, Chris.
Dim dt As New Data.DataTable()
dt = dsusers.Tables("wf_getusernames")
Dim strdelete As String
strdelete = "adminid=" & drpUserNames.SelectedItem.Value
dt.Select(strdelete)
dt.Rows(0).Delete()
which I can get from a the value of a dropdown menu. I tried using the
select method to filter the datatable on the primary key and as this table
should only contain 1 record I should be deleting the right record. It
still, however, deletes the first record in the dataset not the filtered
table. Can anyone help. Some pointers to code examples would be great as
ADO.net is a real weak point. Regards, Chris.
Dim dt As New Data.DataTable()
dt = dsusers.Tables("wf_getusernames")
Dim strdelete As String
strdelete = "adminid=" & drpUserNames.SelectedItem.Value
dt.Select(strdelete)
dt.Rows(0).Delete()