G
Guest
It was suggested that I post this item here. Sorry about the cross post
I am using a datagrid to display information from a table. I have successfully been able to select items and make the values appear in different textboxes on the form. I would like to be able to select a value and the click a command button and delete the corresponding record. When I load the data in the datagrid I do the following
Me.SqlDataAdapter1.SelectCommand.CommandText = "SELECT keyword,description,ID,area FROM Keywords WHERE area = '" & SelArea & "' ORDER BY Keyword
Me.SqlDataAdapter1.Fill(Me.DataSet11
I would like to know how to delete the corresponding record. I would like to do something like the following, but it seems that the dataadapter looks for insert,delete, and update commands.
Me.SqlDataAdapter1.DeleteCommand.CommandText = "delete * from keywords where id=" & Trim(DataGrid1.Item(DataGrid1.CurrentCell.RowNumber.ToString, 2)) &
" and area='" & SelArea & "'
Me.SqlDataAdapter1.Update(something goes here, but i don't know what
How should I be doing this
Thank
I am using a datagrid to display information from a table. I have successfully been able to select items and make the values appear in different textboxes on the form. I would like to be able to select a value and the click a command button and delete the corresponding record. When I load the data in the datagrid I do the following
Me.SqlDataAdapter1.SelectCommand.CommandText = "SELECT keyword,description,ID,area FROM Keywords WHERE area = '" & SelArea & "' ORDER BY Keyword
Me.SqlDataAdapter1.Fill(Me.DataSet11
I would like to know how to delete the corresponding record. I would like to do something like the following, but it seems that the dataadapter looks for insert,delete, and update commands.
Me.SqlDataAdapter1.DeleteCommand.CommandText = "delete * from keywords where id=" & Trim(DataGrid1.Item(DataGrid1.CurrentCell.RowNumber.ToString, 2)) &
" and area='" & SelArea & "'
Me.SqlDataAdapter1.Update(something goes here, but i don't know what
How should I be doing this
Thank