vcherubini
Programmer
Hello.
I come from a PHP/Perl background and have recently been forced into using ASP at work. I am having a problem with getting information about a database so that I can work with it. Specifically, how do I find out the names of the tables in the database?
I am using Access. In PHP, I could VERY easily use code like so:
[tt]
<?php
mysql_connect("localhost", "mysql_user", "mysql_password"
$result = mysql_list_tables("mydb"
for ($i = 0; $i < mysql_num_rows($result); $i++)
printf ("Table: %s\n", mysql_tablename($result, $i));
mysql_free_result($result);
?>
[/tt]
To get all of the names of the tables in a database. In ASP, I've found that to find the names of the fields, you have to query the database first, and then use the rs.Fields(num).Name function to get the names of the fields. However, if I try something like db_conn.Tables(0).Name, I get an error (where db_conn is the variable that holds the connection information to the database).
Thus, how do I get all of the names of each table in my database?
Thanks,
-Vic vic cherubini
krs-one@cnunited.com
I come from a PHP/Perl background and have recently been forced into using ASP at work. I am having a problem with getting information about a database so that I can work with it. Specifically, how do I find out the names of the tables in the database?
I am using Access. In PHP, I could VERY easily use code like so:
[tt]
<?php
mysql_connect("localhost", "mysql_user", "mysql_password"
$result = mysql_list_tables("mydb"
for ($i = 0; $i < mysql_num_rows($result); $i++)
printf ("Table: %s\n", mysql_tablename($result, $i));
mysql_free_result($result);
?>
[/tt]
To get all of the names of the tables in a database. In ASP, I've found that to find the names of the fields, you have to query the database first, and then use the rs.Fields(num).Name function to get the names of the fields. However, if I try something like db_conn.Tables(0).Name, I get an error (where db_conn is the variable that holds the connection information to the database).
Thus, how do I get all of the names of each table in my database?
Thanks,
-Vic vic cherubini
krs-one@cnunited.com