This should be simple but I can't get it to work. I want to update a single
row of data in a table.
ES.Clear()
Dim strSQL As String = "Select * from Contact where sysid = '" &
g_sysID & "'"
DB = New SqlClient.SqlDataAdapter(strSQL, CN)
DB.Fill(ES, "Contact")
If ES.Tables("Contact").Rows.Count > 0 Then
txtAddress.Text =
ES.Tables("Contact").Rows(0).Item("con1_02_03")
txtFirst_Name.Text =
ES.Tables("Contact").Rows(0).Item("First_Name")
txtLast_Name.Text =
ES.Tables("Contact").Rows(0).Item("Last_Name")
End If
I hope the above is correct
Now in another routine I want to update
Dim objRow As Data.DataRow
objRow = ES.Tables("Contact").Rows(0)
objRow.BeginEdit()
objRow("First_Name") = "Gary"
objRow("Last_Name") = "Smith"
objRow("con1_02_03") = "New Address"
objRow.EndEdit()
objRow.AcceptChanges()
DB.Update(ES, "Contact")
What on earth am I doing wrong?
Thanks,
Gary