Hello!
I am trying to get Table Name from Access database by using ADO.NET.
Here is the code that I used. After run, it appears error as "An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll"
If I change the table from MSysObjects to be other regular tables, it works fine. So, I am wondering if ADO.NET can be used to access to the system table or not. Or What I have been doing wrong? Would you please help advice?
Thank you very much.
Tanai
I am trying to get Table Name from Access database by using ADO.NET.
Here is the code that I used. After run, it appears error as "An unhandled exception of type System.Data.OleDb.OleDbException occurred in system.data.dll"
Code:
Dim DataCommand As OleDbCommand
Dim DataReader As OleDbDataReader
DataCommand = New OleDbCommand
DataCommand.Connection = DataConnection
DataCommand.CommandType = CommandType.Text
DataCommand.CommandText = "SELECT * FROM MSysObjects Where Type=1 and Flags=0"
DataConnection.Open()
DataReader = DataCommand.ExecuteReader
If DataReader.HasRows Then
MsgBox("OK, there are some tables!")
Else
Msgbox("There is no table!")
End If
DataReader.Close()
Thank you very much.
Tanai