I'm Getting a syntax error in the form clause in this code, can anyone help? Thanks :)
Dim sql As String
Dim con As New OleDb.OleDbConnection
Dim da As OleDb.OleDbDataAdapter
Dim ds As New DataSet
con.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0; Data Source = G:\school\Thespellingbee\Resources\Spelling Bee1.mdb"
con.Open()
sql = "SELECT * FROM Words + Definitions"
da = New OleDb.OleDbDataAdapter(sql, con)
da.Fill(ds, "Words + Definitions")
con.Close()
Dim cb As New OleDb.OleDbCommandBuilder(da) stored data adapter in the variable cb
WordTextBox.Text = ds.Tables("Words + Definitions").Rows(0).Item(2)
DescriptionTextBox.Text = ds.Tables("Words + Definitions").Rows(0).Item(3)
da.Update(ds, "Words + Definitions")
MsgBox("It's working", MessageBoxButtons.OK)
This is me trying to update the database using a dataset and adapter, im still fairly new to v basic as i have just started learning it in A-level.
I think your this line is creating a problem:-
sql = "SELECT * FROM Words + Definitions"
I dont think that this is allowed. You cannot join tables using +(considering Words and Definitions as tables)
And if the table name is Words + Definitions the you may try this:-
sql = "SELECT * FROM [Words + Definitions]"
Also this line should be changes from
da.Fill(ds, "Words + Definitions")
to simple this:-
da.Fill(ds)