Im getting the "Syntax error in INSERT INTO statement." at my
da.Update(ds, "Expenses") line in code... heres my full code to follow.
------------------------------------------------------------------------------------------------------------
Private Sub ConnectToolStri pMenuItem_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ConnectToolStri pMenuItem.Click
con.ConnectionS tring = "PROVIDER=Micro soft.Jet.OLEDB. 4.0;Data Source = C:\Documents and Settings\eneal\ Desktop\Budgeti ngDatabase.mdb"
con.Open()
MsgBox("A Connection to the Database is now open")
sqlExp = "Select * FROM Expenses"
da = New OleDb.OleDbData Adapter(sqlExp, con)
da.Fill(ds, "Expenses")
End sub
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
Private Sub btnCommit_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnCommit.Click
Dim cb As New OleDb.OleDbComm andBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Expe nses").NewRow()
dsNewRow.Item(" Expense Description") = Expense_Descrip tionTextBox.Tex t
ds.Tables("Expe nses").Rows.Add (dsNewRow)
da.Update(ds, "Expenses") ****This is the line my problems at*
MsgBox("New Record added to the Database")
End Sub
------------------------------------------------------------------------------------------------------
I've searched high an low to an answer for this problem but nothing has seemed remotly close to what I'm experiencing.
da.Update(ds, "Expenses") line in code... heres my full code to follow.
------------------------------------------------------------------------------------------------------------
Private Sub ConnectToolStri pMenuItem_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles ConnectToolStri pMenuItem.Click
con.ConnectionS tring = "PROVIDER=Micro soft.Jet.OLEDB. 4.0;Data Source = C:\Documents and Settings\eneal\ Desktop\Budgeti ngDatabase.mdb"
con.Open()
MsgBox("A Connection to the Database is now open")
sqlExp = "Select * FROM Expenses"
da = New OleDb.OleDbData Adapter(sqlExp, con)
da.Fill(ds, "Expenses")
End sub
----------------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
Private Sub btnCommit_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnCommit.Click
Dim cb As New OleDb.OleDbComm andBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("Expe nses").NewRow()
dsNewRow.Item(" Expense Description") = Expense_Descrip tionTextBox.Tex t
ds.Tables("Expe nses").Rows.Add (dsNewRow)
da.Update(ds, "Expenses") ****This is the line my problems at*
MsgBox("New Record added to the Database")
End Sub
------------------------------------------------------------------------------------------------------
I've searched high an low to an answer for this problem but nothing has seemed remotly close to what I'm experiencing.
Comment