473,432 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,432 software developers and data experts.

how to get db tables?

Ciary
247 Expert 100+
hi all, seems like i'm stuck with another problem. in my website i'm using a access database. to do this, i used odbc with a connection string. what i want to do now is print a list of all tables in this connection. does anyone know how this can be done?


the code below is what i have so far. it returns the fields of 1 table:
Expand|Select|Wrap|Line Numbers
  1. db_connection = new COM("ADODB.Connection", NULL, 1251);
  2. $db_connstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=".$path."Persist Security Info=False;";
  3.  
  4. $db_connection->open($db_connstr);
  5. $query = "SELECT * FROM goo";
  6. $rs = $db_connection->execute($query);
  7. $rs_fld0 = $rs->Fields(0);
  8. $rs_fld1 = $rs->Fields(1);
  9. $rs_fld2 = $rs->Fields(2);
  10.  
  11. $fields = array();
  12. for( $x = 0; $x < $rs->Fields->Count; $x++ ){
  13.     $fields[] = $rs->Fields[$x]->Name;
  14. }
  15.  
  16.  
  17. $rs->Close();
  18. $db_connection->Close(); 
  19. ?>
Apr 17 '09 #1
3 2404
Markus
6,050 Expert 4TB
This thread may be of some help to you.

I'm not experienced with ODBC, though.

Let me know how you get on.

Mark.
Apr 17 '09 #2
Ciary
247 Expert 100+
not really :(
but i found another way.
now, i'm reading the system tables of access. i dont know if you're familiar with access but normally on the left side of the screen there is a navigation pane. the contents of this pane are stored in the table: MSysNavPaneObjectIDs. if you read this one and filter its contents, you get your own tables. you need to filter on type (1 for tables) and filter the system tables (those are always the same so i've put them in an array for those who want to do the same.

Expand|Select|Wrap|Line Numbers
  1. $notMyTables = array(MSysDb, MSysObjects, MSysACEs, MSysQueries, MSysRelationships, MSysComplexColumns, MSysComplexType_UnsignedByte, MSysComplexType_Short, MSysComplexType_Long, MSysComplexType_IEEESingle, MSysComplexType_IEEEDouble, MSysComplexType_GUID, MSysComplexType_Decimal, MSysComplexType_Text, MSysComplexType_Attachment, MSysAccessStorage, MSysAccessXML, MSysIMEXColumns, MSysIMEXSpecs, MSysNavPaneGroupCategories, MSysNavPaneGroups, MSysNavPaneGroupToObjects, MSysNavPaneObjectIDs);
tnx anyway Marcus
Apr 20 '09 #3
Ciary
247 Expert 100+
one more thing (for future users), mdb is slightly different then accdb. first you need to add "MSysAccessObjects, " to your array.

second, you need to change the permissions of the MSysNavPaneObjectIDs table. it hasn't any which will make it unable to be read outside access.

if anyone needs the full code, just ask.
Apr 20 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
3
by: Random Person | last post by:
Does anyone know how to use VBA to relink tables between two MS Access databases? We have two databases, one with VBA code and the other with data tables. The tables are referenced by linked...
11
by: dskillingstad | last post by:
I've been struggling with this problem for some time and have tried multiple solutions with no luck. Let me start with, I'm a novice at Access and I'm not looking for someones help to design my...
2
by: Jill Elaine | last post by:
I am building an Access 2002 frontend with linked tables to an encrypted Paradox 7 database. When I first create these linked tables, I'm asked for the password to the encrypted Paradox database,...
1
by: Shelby | last post by:
Problem: My company generates its own data export from a propietary database. These (free) tables can be read in C#.NET using a Visual FoxPro driver (vfpoledb). I can read each of the six tables...
59
by: phil-news-nospam | last post by:
In followups by Brian O'Connor (ironcorona) to other posts, he repeats the idea that using tables in CSS is not something that should be done because IE doesn't support it. Of course I'm not happy...
5
by: rdemyan via AccessMonster.com | last post by:
I have a need to add another field to all of my tables (over 150). Not data, but an actual field. Can I code this somehow. So the code presumabley would loop through all the tables, open each...
4
by: db2admin | last post by:
Hello, I want to plan rearranging tables in our database according to business areas. say all tables in business area A will be in seperate tablespace or tablespaces. I am planning to monitor...
25
by: bubbles | last post by:
Using Access 2003 front-end, with SQL Server 2005 backend. I need to make the front-end application automatically refresh the linked SQL Server tables. New tables will be added dynamically in...
11
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night)...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.