dataAdapter

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

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
 
* "=?Utf-8?B?bWlrZQ==?= said:
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)

Why not post questions like this to the ADO.NET group?

<
Web interface:

<http://msdn.microsoft.com/newsgroups/?dg=microsoft.public.dotnet.framework.adonet>
 
Back
Top