A
Adam Sim via .NET 247
(Type your message here)
--------------------------------
From: Adam Sim
Hello, I am trying to update the data in an MS Access table using a Visual Basic Windows Application. The way I tried to do it has worked in the past, but now it seems to give a "concurrency violation."
if either the starred lines is in the code it produces a concurrency error, if they are not it does not produce an error but, of course, the original data is not changed. I have checked my table in access and it seems that all the formats are correct.
Thanks for your help
Adam
Here is the code:
Note: selid is a public variable for the case number of the record being worked upon
Sub save_art()
Dim strConnect As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& "C:\Documents and Settings\Owner\My Documents\Visual Studio Projects\mpqgrammar.mdb"
Dim cn1 As OleDbConnection = New OleDbConnection(strConnect)
cn1.Open()
Dim strSelectOut As String = _
"SELECT * FROM MPQFIN WHERE CASENO = " & selID
Dim dsOutCmd As New OleDbDataAdapter(strSelectOut, cn1)
Dim dsOutCmdBuild As OleDbCommandBuilder = New OleDbCommandBuilder(dsOutCmd)
Dim dsOut As New DataSet()
dsOutCmd.Fill(dsOut, "MPQFIN")
dsOut.Tables(0).Rows(0).Item("Done") = 1 '************
dsOut.Tables(0).Rows(0).Item("Coder") = userName '************
dsOutCmd.Update(dsOut, "MPQFIN")
cn1.Close()
MessageBox.Show("Record Saved!", "Save")
--------------------------------
From: Adam Sim
Hello, I am trying to update the data in an MS Access table using a Visual Basic Windows Application. The way I tried to do it has worked in the past, but now it seems to give a "concurrency violation."
if either the starred lines is in the code it produces a concurrency error, if they are not it does not produce an error but, of course, the original data is not changed. I have checked my table in access and it seems that all the formats are correct.
Thanks for your help
Adam
Here is the code:
Note: selid is a public variable for the case number of the record being worked upon
Sub save_art()
Dim strConnect As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" _
& "C:\Documents and Settings\Owner\My Documents\Visual Studio Projects\mpqgrammar.mdb"
Dim cn1 As OleDbConnection = New OleDbConnection(strConnect)
cn1.Open()
Dim strSelectOut As String = _
"SELECT * FROM MPQFIN WHERE CASENO = " & selID
Dim dsOutCmd As New OleDbDataAdapter(strSelectOut, cn1)
Dim dsOutCmdBuild As OleDbCommandBuilder = New OleDbCommandBuilder(dsOutCmd)
Dim dsOut As New DataSet()
dsOutCmd.Fill(dsOut, "MPQFIN")
dsOut.Tables(0).Rows(0).Item("Done") = 1 '************
dsOut.Tables(0).Rows(0).Item("Coder") = userName '************
dsOutCmd.Update(dsOut, "MPQFIN")
cn1.Close()
MessageBox.Show("Record Saved!", "Save")