Sundip Mistry
New member
- Joined
- Dec 12, 2011
- Messages
- 2
- Programming Experience
- Beginner
Hi there,
i've written all my code up to send or create data in access however I keep receiving the error of :-
OleDbException was unhandled
Syntax error in INSERT INTO statement.
I haven't got the faintest clue of what's gone wrong, I'm a beginner hear, just started programming a few weeks or a month ago.
If someone can help me, I'd be really grateful.
thank You and much appreciation
Sundip
Following syntax (vb.net)
Imports System.Data.OleDb
Private Sub showItems()
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter
con.Open()
da = New OleDbDataAdapter("Select * from MainT", con)
da.Fill(dt)
con.Close()
End Sub
Private Sub frm_Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'connection between vb.net & microsoft access
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data source=C:\Users\Sundip\Documents\Visual Studio 2010\Projects\WareHouse_Stock_Auto_Controller\WareHouse_Stock_Auto_Controller\stock.mdb"
con.Open()
con.Close()
showItems()
End Sub
Private Sub bttn_Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttn_Add.Click
Dim Iteming As String
Iteming = txt_Add.Text
lst_Items.Items.Add(txt_Add.Text)
con.Open()
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter
da = New OleDbDataAdapter("Select * from MainT", con)
da.Fill(dt)
Dim newRow As DataRow = dt.NewRow
With newRow
.Item("ID") = txt_ID.Text
.Item("ProductName") = txt_Add.Text
End With
dt.Rows.Add(newRow)
Dim cb As New OleDbCommandBuilder(da)
da.Update(dt)
con.Close()
showItems()
End Sub
i've written all my code up to send or create data in access however I keep receiving the error of :-
OleDbException was unhandled
Syntax error in INSERT INTO statement.
I haven't got the faintest clue of what's gone wrong, I'm a beginner hear, just started programming a few weeks or a month ago.
If someone can help me, I'd be really grateful.
thank You and much appreciation
Sundip
Following syntax (vb.net)
Imports System.Data.OleDb
Private Sub showItems()
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter
con.Open()
da = New OleDbDataAdapter("Select * from MainT", con)
da.Fill(dt)
con.Close()
End Sub
Private Sub frm_Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'connection between vb.net & microsoft access
con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data source=C:\Users\Sundip\Documents\Visual Studio 2010\Projects\WareHouse_Stock_Auto_Controller\WareHouse_Stock_Auto_Controller\stock.mdb"
con.Open()
con.Close()
showItems()
End Sub
Private Sub bttn_Add_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttn_Add.Click
Dim Iteming As String
Iteming = txt_Add.Text
lst_Items.Items.Add(txt_Add.Text)
con.Open()
Dim dt As New DataTable
Dim ds As New DataSet
ds.Tables.Add(dt)
Dim da As New OleDbDataAdapter
da = New OleDbDataAdapter("Select * from MainT", con)
da.Fill(dt)
Dim newRow As DataRow = dt.NewRow
With newRow
.Item("ID") = txt_ID.Text
.Item("ProductName") = txt_Add.Text
End With
dt.Rows.Add(newRow)
Dim cb As New OleDbCommandBuilder(da)
da.Update(dt)
con.Close()
showItems()
End Sub