G
Guest
I am able to get this section of code to properly open an Access database and fill the dataset from a table within it. Then after editing certain values in the dataset attempt to update I get an unhandled exception. After trapping the code in a try it returns "Syntax Error in UPDATE Statement" however I have tried all documents and syntax appears correct. I've verified that I am not using any reserved words for column names in the Access database. This problem is quite frustrating. Any help is appreciated. Here is my code
-----------------------------
Dim strConnect1 As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
& "E:\Microsoft Visual Studio .NET\Projects\GrammarMachine\mpqgrammar.mdb
Dim cn1 As OleDbConnection = New OleDbConnection(strConnect1
cn1.Open(
Dim strSelectOut1 As String =
"SELECT * FROM MPQFIN WHERE CASENO = " & selI
Dim dsOutCmd As New OleDbDataAdapter(strSelectOut1, cn1
Dim dsOutCmdBuild As OleDbCommandBuilder = New OleDbCommandBuilder(dsOutCmd
Dim dsOut As New DataSet(
dsOutCmd.Fill(dsOut, "MPQFIN"
dsOut.Tables(0).Rows(0).Item("Done") =
dsOut.Tables(0).Rows(0).Item("Coder") = userNam
dsOut.Tables(0).Rows(0).Item("ACTOR") = RTBSpon.Tex
dsOut.Tables(0).Rows(0).Item("ACTION") = RTBAct.Tex
dsOut.Tables(0).Rows(0).Item("CONSEQ") = RTBCon.Tex
dsOut.Tables(0).Rows(0).Item("BACK") = RTBBack.Tex
dsOut.Tables(0).Rows(0).Item("DEFINE") = RTBDef.Tex
Tr
dsOutCmd.Update(dsOut, "MPQFIN"
Catch Ex As Exceptio
Console.WriteLine("Error: " & Ex.Message
MsgBox("Error: " & Ex.Message
End Try
-----------------------------
Dim strConnect1 As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
& "E:\Microsoft Visual Studio .NET\Projects\GrammarMachine\mpqgrammar.mdb
Dim cn1 As OleDbConnection = New OleDbConnection(strConnect1
cn1.Open(
Dim strSelectOut1 As String =
"SELECT * FROM MPQFIN WHERE CASENO = " & selI
Dim dsOutCmd As New OleDbDataAdapter(strSelectOut1, cn1
Dim dsOutCmdBuild As OleDbCommandBuilder = New OleDbCommandBuilder(dsOutCmd
Dim dsOut As New DataSet(
dsOutCmd.Fill(dsOut, "MPQFIN"
dsOut.Tables(0).Rows(0).Item("Done") =
dsOut.Tables(0).Rows(0).Item("Coder") = userNam
dsOut.Tables(0).Rows(0).Item("ACTOR") = RTBSpon.Tex
dsOut.Tables(0).Rows(0).Item("ACTION") = RTBAct.Tex
dsOut.Tables(0).Rows(0).Item("CONSEQ") = RTBCon.Tex
dsOut.Tables(0).Rows(0).Item("BACK") = RTBBack.Tex
dsOut.Tables(0).Rows(0).Item("DEFINE") = RTBDef.Tex
Tr
dsOutCmd.Update(dsOut, "MPQFIN"
Catch Ex As Exceptio
Console.WriteLine("Error: " & Ex.Message
MsgBox("Error: " & Ex.Message
End Try