0
Answer

keep getting syntax error when trying to update database

Leo Lynch

Leo Lynch

15y
2.2k
1
i keep getting a "syntax error in INSERT INTO statement"

could i be informed on where my error is here is the code:

 Dim cb As New OleDb.OleDbCommandBuilder(da2)
        Dim cb2 As New OleDb.OleDbCommandBuilder(da3)
        Dim dsNewRow As DataRow
        Dim balanceDecimal As Decimal = ds2.Tables("dbInfo").Rows(0).Item(3)

        dsNewRow = ds3.Tables("dbInfo").NewRow()

        dsNewRow.Item("TransDate") = mtxbDate.Text
        dsNewRow.Item("CheckNumber") = Decimal.Parse(txtCheck.Text)
        dsNewRow.Item("Desc") = txtDesc.Text
        If MessageBox.Show("Is this a withdraw?", "Comfirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) _
                    = Windows.Forms.DialogResult.Yes Then
            dsNewRow.Item("Withdraw") = Decimal.Parse(txtAmount.Text)
            balanceDecimal = balanceDecimal - Decimal.Parse(txtAmount.Text)
            ds2.Tables("dbInfo").Rows(0).Item(3) = balanceDecimal
        Else
            dsNewRow.Item("Deposit") = Decimal.Parse(txtAmount.Text)
            balanceDecimal = balanceDecimal + Decimal.Parse(txtAmount.Text)
            ds2.Tables("dbInfo").Rows(0).Item(3) = balanceDecimal
        End If



        ds3.Tables("dbInfo").Rows.Add(dsNewRow)
        da3.Update(ds3, "dbInfo")  '<---- the error hits here
        da2.Update(ds2, "dbInfo")