J
Joe Delphi
Hi,
I am using ADO.NET 1.1 and am attempting to UPDATE a record in the
Access database. Problem is that the statements execute fine with no
error, but when I look at the database I see that the update did not really
happen. What is wrong? Do I need to somehow commit the transaction?
My code is below:
Dim cmdUpdate As System.Data.OleDb.OleDbCommand
daChangeRequests.UpdateCommand.CommandText = _
"UPDATE CHANGE_REQUESTS " & _
"SET TITLE = '" & Me.txtTitle.Text & "', " & _
"DESCRIPTION = '" & Me.txtDescription.Text & "', " & _
"PRIORITY = " & CInt(Me.ddlstPriority.SelectedItem.Text) & ", " & _
"SUB_BY = '" & Me.ddlstSubBy.SelectedItem.Text & "', " & _
"ASSIGNED_TO = '" & Me.ddlstAssigned.SelectedItem.Text & "', " & _
"NOTES = '" & Me.txtNotes.Text & "' " & _
"WHERE CR_ID = " & Me.txtCRID.Text
cmdUpdate = Me.daChangeRequests.UpdateCommand
Try
cnChangeRequests.Open()
cmdUpdate.ExecuteNonQuery()
lblSaved.Visible = True
lblSaved.ForeColor = White
lblSaved.Text = "CR Succesfully Updated"
Catch
cnChangeRequests.Close()
lblSaved.Visible = True
lblSaved.ForeColor = Red
lblSaved.Text = Err.Description
End Try
cnChangeRequests.Close()
End Sub
I am using ADO.NET 1.1 and am attempting to UPDATE a record in the
Access database. Problem is that the statements execute fine with no
error, but when I look at the database I see that the update did not really
happen. What is wrong? Do I need to somehow commit the transaction?
My code is below:
Dim cmdUpdate As System.Data.OleDb.OleDbCommand
daChangeRequests.UpdateCommand.CommandText = _
"UPDATE CHANGE_REQUESTS " & _
"SET TITLE = '" & Me.txtTitle.Text & "', " & _
"DESCRIPTION = '" & Me.txtDescription.Text & "', " & _
"PRIORITY = " & CInt(Me.ddlstPriority.SelectedItem.Text) & ", " & _
"SUB_BY = '" & Me.ddlstSubBy.SelectedItem.Text & "', " & _
"ASSIGNED_TO = '" & Me.ddlstAssigned.SelectedItem.Text & "', " & _
"NOTES = '" & Me.txtNotes.Text & "' " & _
"WHERE CR_ID = " & Me.txtCRID.Text
cmdUpdate = Me.daChangeRequests.UpdateCommand
Try
cnChangeRequests.Open()
cmdUpdate.ExecuteNonQuery()
lblSaved.Visible = True
lblSaved.ForeColor = White
lblSaved.Text = "CR Succesfully Updated"
Catch
cnChangeRequests.Close()
lblSaved.Visible = True
lblSaved.ForeColor = Red
lblSaved.Text = Err.Description
End Try
cnChangeRequests.Close()
End Sub