first
select context menu strip from toolbox in VS IDE 2005..... drag into form..default name as "context menu strip1" add items like delete,update......
2.add datagrid or gridview to form
3.in grid view property window select contextmenu and choose "context menu strip1"
4.Now select context menu strip click on any items go code window..
in your case try this for delete
Private
Dim con As New SqlConnection
con = 'your connection string'
con.Open()
Dim a As IntegerDim str As Stringa = DataGrid1.CurrentRowIndex
str =
"delete * from class where id = '" + DataGrid1(a, 0) + "' "Dim cmd As New SqlCommand(str, con)cmd.ExecuteNonQuery()
con.Close()
End Subtry for update also .....
first
select context menu strip from toolbox in VS IDE 2005..... drag into form..default name as "context menu strip1" add items like delete,update......
2.add datagrid or gridview to form
3.in grid view property window select contextmenu and choose "context menu strip1"
4.Now select context menu strip click on any items go code window..
in your case try this for delete
Private
Dim con As New SqlConnection
con = 'your connection string'
con.Open()
Dim a As IntegerDim str As Stringa = DataGrid1.CurrentRowIndex
str =
"delete * from class where id = '" + DataGrid1(a, 0) + "' "Dim cmd As New SqlCommand(str, con)cmd.ExecuteNonQuery()
con.Close()
End Sub
here class is table name id is first coloumn of table....
try for update also .....