Well, I added the following code to my update procedure. Now it updates, but
isnt' it supposed to be simpler than this?
---------------------------------------------------------
Private Sub UpdateTblHistory()
Dim strSql, str1 As String
For Each dr As DataRow In ds.Tables("tbl_History").Rows
If dr.RowState = DataRowState.Modified Then
str1 = dr("SubscrID").ToString
dr.BeginEdit()
dr("SubscrID") = str1
dr.EndEdit()
End If
Next
strSql = "Update tbl_History set SubscrID = @SubscrID Where ID = @ID"
da.UpdateCommand.CommandText = strSql
da.UpdateCommand.Parameters.Add("@SubscrID", SqlDbType.VarChar, 50,
"SubscrID")
da.UpdateCommand.Parameters.Add("@ID", SqlDbType.Int, 4, "ID")
da.Update(ds, "tbl_History")
End Sub
-----------------------------------------------------------------
"Rich" wrote:
Private Sub UpdateTblHistory()
Dim strSql As String
strSql = "Update tbl_History set SubscrID = @SubscrID Where ID = @ID"
da.UpdateCommand.CommandText = strSql
da.UpdateCommand.Parameters.Add("@SubscrID", SqlDbType.VarChar, 50,
"SubscrID")
da.UpdateCommand.Parameters.Add("@ID", SqlDbType.Int, 4, "ID")
da.Update(ds, "tbl_History")
End Sub
----------------------------------------------------------------------------------
I am displaying a row from tbl_History in a datagridview. In the
datagridview_CellValueChanged event I call the update procedure above. The
code runs but tbl_History is not getting updated. Can anyone see why
tbl_History wont update?
Thanks,
Rich