I am using Access 2013 as database in Visual studio 2017. The database is connected and all but when i run this code:
myConnToAccess = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database11.accdb")
myConnToAccess.Open()
ds = New DataSet
tables = ds.Tables
da = New OleDbDataAdapter("SELECT Typ záznamu from Typ", myConnToAccess)
da.Fill(ds, "Typ")
Dim view1 As New DataView(tables(0))
With ComboBox1
.DataSource = ds.Tables("Typ")
.DisplayMember = "Typ záznamu"
.ValueMember = "Typ záznamu"
.SelectedIndex = 0
.AutoCompleteMode = AutoCompleteMode.SuggestAppend
.AutoCompleteSource = AutoCompleteSource.ListItems
End With
I get the **System.Data.OleDb.OleDbException: 'Syntax error (missing operator) in query expression 'Typ záznamu'.' **
I have the
Dim mySQLCommand As OleDbCommand
Dim mySQLStrg As String
Dim ds As DataSet
Dim da As OleDbDataAdapter
Dim tables As DataTableCollection
Dim myConnToAccess As OleDbConnection
in the begining of the class... also the:
Imports System.Data.OleDb
I dont know what to d any more... can someone please help me?
If you want to query the column Typ záznamu
then you need to put it in square brackets because of the space
between the words.
da = New OleDbDataAdapter("SELECT [Typ záznamu] from Typ", myConnToAccess)