Hi,
I am new to this forum and have been troubled by this problem for the past few days. I would appreciate if someone would take a look and help me out.
I am using vb express 2005 edition... I have problem when updating MS Access database from dataset using vb(2005)
I get an error prompt when debugging
System.Oledb.Ol edbException: {"Syntax error in INSERT INTO statement."}
error code: -2147217900
error source: Microsoft JET Database Engine
I am new to this forum and have been troubled by this problem for the past few days. I would appreciate if someone would take a look and help me out.
I am using vb express 2005 edition... I have problem when updating MS Access database from dataset using vb(2005)
Code:
Dim sql As String = "SELECT * FROM SB_ADWarning" Dim strConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\SB_2000.mdb" Dim Con As New OleDbConnection(strConnString) Dim da As New OleDbDataAdapter(sql, Con) Dim ds As New DataSet() Dim dt As DataTable Dim dsNewRow As DataRow Dim cb As OleDbCommandBuilder = New OleDbCommandBuilder(da) da.Fill(ds, "ADWarning") Con.Close() dt = ds.Tables("ADWarning") Try dsNewRow = dt.NewRow() dsNewRow("IssueDate") = Me.TextBox1.Text dsNewRow("IssueTime") = Me.TextBox2.Text dsNewRow("FcstOnsetTime") = Me.TextBox3.Text dsNewRow("FcstCldAmt") = Me.TextBox4.Text dt.Rows.Add(dsNewRow) Dim drModified As DataRow() = dt.Select(Nothing, Nothing, DataViewRowState.Added) Con.Open() ListBox1.DataSource = ds.Tables("ADWarning") ListBox1.DisplayMember = "IssueDate" da.UpdateCommand = cb.GetInsertCommand da.Update(drModified) MessageBox.Show("Database has been updated!", "Data", MessageBoxButtons.OK, MessageBoxIcon.Information) Catch eInsertException As Exception MsgBox(eInsertException.Message & eInsertException.Source) Throw eInsertException Finally Con.Close() End Try
System.Oledb.Ol edbException: {"Syntax error in INSERT INTO statement."}
error code: -2147217900
error source: Microsoft JET Database Engine
Comment