Hi. I am having problems getting a record to update from a gridview. I'm using vs2008 sp 1. Here is my update query:
UPDATE VehicleTare SET NotesArea = ? WHERE (LocationID = LocationID) AND (VehicleID = VehicleID)
I have defined the two parameters LocationID and VehicleID, so it is passing the correct values. I've tried trapping the new value in NotesArea in a string, but I can't get the syntax so it passes the new value. Here is my code for it (in VB)
Private Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Dim count As New Integer
strLocID = ""
strVehicle = ""
Try
'Dim row As GridViewRow
count = e.RowIndex
strVehicle = (GridView1.Rows(count).Cells(2).Text)
strNotes = (GridView1.Rows(count).Cells(7).Text) ' this should be the new value)
txtVehicleID.Text = strVehicle
Catch EX As Exception
End Try
End Sub
I would appreciate any help and yes I have googled it.
Thanks
Cathy
UPDATE VehicleTare SET NotesArea = ? WHERE (LocationID = LocationID) AND (VehicleID = VehicleID)
I have defined the two parameters LocationID and VehicleID, so it is passing the correct values. I've tried trapping the new value in NotesArea in a string, but I can't get the syntax so it passes the new value. Here is my code for it (in VB)
Private Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
Dim count As New Integer
strLocID = ""
strVehicle = ""
Try
'Dim row As GridViewRow
count = e.RowIndex
strVehicle = (GridView1.Rows(count).Cells(2).Text)
strNotes = (GridView1.Rows(count).Cells(7).Text) ' this should be the new value)
txtVehicleID.Text = strVehicle
Catch EX As Exception
End Try
End Sub
I would appreciate any help and yes I have googled it.
Thanks
Cathy