Hi, i currently has this code. When on click on the "Approve" button, the database of all the rows will change. I have "Approve" button on every row. How do i make it so that only the selected rows will change? Pls help. Thank in advance.
Sub CustomersGridView_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
Dim str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath("database\db1.mdb")
Dim row As GridViewRow = GridView1.SelectedRow
If e.CommandName = "Approve" Then
'Dim index As Integer
Dim mySelectQuery As String = "SELECT State, FileID FROM Table3"
Dim myUpdateQuery As String = "Update Table3 Set State='6' "
Dim myConnection As New OleDbConnection(str)
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
Dim myCommand2 As New OleDbCommand(myUpdateQuery, myConnection)
Dim retvalue As Integer
myConnection.Open()
myCommand2.ExecuteNonQuery()
Console.WriteLine(retvalue)
Dim myReader As OleDbDataReader
myReader = myCommand.ExecuteReader()
While myReader.Read()
Label1.Text = ("Approve")
End While
myReader.Close()
myConnection.Close()
End If
End Sub
p.s I'm using vb 2005