pandkyon
asked on
List of Table names
Hello Experts,
I'm trying to connect to various databases and I need to pull back the table names after I connect. I am able to identify the database type ( Oracle, DB2, MSSQL & Access) before i connect based on the driver name I capture in a variable. Once conncected, I need the appropriate SQL string to be sent to the database based on the database type.
What would be the best way to accomplish this.
PSEDUOCODE:
if driver.text = Oracle then
sqlstring=("SELECT .... FROM.....'")
if driver.text = IBM DB2 then
sqlstring=("SELECT .... FROM.....'")
if driver.text = Access then
sqlstring=("SELECT .... FROM.....'")
if driver.text =MSSQL then
sqlstring=("SELECT .... FROM.....'")
The snippet I use below works fine for an Oracle database.
oODBCConnection = New Odbc.OdbcConnection(sConnS tring)
oODBCConnection.Open()
Dim DA As New Odbc.OdbcDataAdapter("SELE CT table_name from Tabs ORDER BY Table_Name;", _ oODBCConnection)
Thanks in advance
Pandkyon
I'm trying to connect to various databases and I need to pull back the table names after I connect. I am able to identify the database type ( Oracle, DB2, MSSQL & Access) before i connect based on the driver name I capture in a variable. Once conncected, I need the appropriate SQL string to be sent to the database based on the database type.
What would be the best way to accomplish this.
PSEDUOCODE:
if driver.text = Oracle then
sqlstring=("SELECT .... FROM.....'")
if driver.text = IBM DB2 then
sqlstring=("SELECT .... FROM.....'")
if driver.text = Access then
sqlstring=("SELECT .... FROM.....'")
if driver.text =MSSQL then
sqlstring=("SELECT .... FROM.....'")
The snippet I use below works fine for an Oracle database.
oODBCConnection = New Odbc.OdbcConnection(sConnS
oODBCConnection.Open()
Dim DA As New Odbc.OdbcDataAdapter("SELE
Thanks in advance
Pandkyon
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I am not sure either, just see what happens if you issue it.
ASKER
ChetOS82:, Your solutions plus the snippet below works for all the dbs I have access to. Points awarded. Thanks,
Pandkyon
Pandkyon
Dim DA As New Odbc.OdbcDataAdapter("SELECT * FROM SYSIBM.SYSTABLES TAB;", oODBCConnection)
ASKER
I will try the two suggestions for SQL and Access. I 'm not quite sure how to use the "List Table" in an sql statement. could you elaborate?
thanks!
Pandkyon