Whenever I want to select tables names from specific Ms Access 2007 database, I use this SQL request:
SELECT name from msysobjects WHERE type=1 and flags=0
My VB.NET source code:
Connection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + _
"Data Source=" & Text1.Text
Connection.Open()
' sql = "SELECT MSysObjects.Name AS table_name FROM MSysObjects"
sql = "SELECT name from msysobjects WHERE Type = 1 And flags = 0"
Dim commande As OleDbCommand
commande = New OleDbCommand(sql, Connection)
Dim dataReader As OleDbDataReader
Try
dataReader = commande.ExecuteReader()
While (dataReader.Read())
tableNameBox.Text = dataReader.GetString(0)
End While
Catch ex As Exception
MsgBox("Problème de connection " & ex.Message())
End Try
I always get this exception:
no read permission on 'msysobjects'
My purpose is to show tables names in comboBox Thank you