Recent

Author Topic: Table ODBC MSAccess  (Read 2843 times)

VB_Lazarus

  • Newbie
  • Posts: 4
Table ODBC MSAccess
« on: April 02, 2020, 05:08:39 pm »
Hello,
Is there any way to read all the tables from a MSAccess DB with an ODBC Connection?

I tried the SQL with select MSysObjects. But I got the message I have no access to do this.

Thanks.

best regards

af0815

  • Hero Member
  • *****
  • Posts: 586
Re: Table ODBC MSAccess
« Reply #1 on: April 02, 2020, 07:26:29 pm »
IMHO is there a Problem with ODBC, it can not access with the rigths to get information from MSysObjects. I got a lot of samples wirh google but no realy workable soulution, except you manipulate the rights for the MSysObjwcts table, but this is not possible with ODBC
regards
Andreas

LacaK

  • Hero Member
  • *****
  • Posts: 606
Re: Table ODBC MSAccess
« Reply #2 on: May 11, 2020, 09:16:19 am »
If you want list of tables you can use: TSQLConnection.GetTableNames ?

wp

  • Hero Member
  • *****
  • Posts: 7760
Re: Table ODBC MSAccess
« Reply #3 on: May 11, 2020, 01:27:49 pm »
I picked up LacaK's idea and applied it to one of my default samples - see attached demo. Yes, it is working. Simply call SQLConnection.GetTablenames and provide a TStrings parameter, in my example the items of the listbox at the the left to populate it with the table names in the database. Click on a tablename to open the corresponding query.
« Last Edit: May 12, 2020, 10:57:02 am by wp »
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...

 

TinyPortal © 2005-2018