Listing databases

T

Terry Olsen

I'm building a database export program where I want to allow the user to
choose a connection type (ODBC,OLEDB, or SQL), enter a connection
string, and then export the schema and a number of rows of data.

I need to fill a listbox with database names which the user id has read
access.

How would I go about getting the list of databases from a database
server such as SQL, Pervasive, Oracle, etc? Is there a generic method
that works regardless of database provider?
 
M

Mythran

Terry Olsen said:
I'm building a database export program where I want to allow the user to
choose a connection type (ODBC,OLEDB, or SQL), enter a connection
string, and then export the schema and a number of rows of data.

I need to fill a listbox with database names which the user id has read
access.

How would I go about getting the list of databases from a database
server such as SQL, Pervasive, Oracle, etc? Is there a generic method
that works regardless of database provider?

I wrote a database definition program awhile back that lists databases from
a server, then lists tables/column info and allows printing of the database
structure(s). What I did was created an interface (IDatabaseInfo for
example) and had methods called GetDatabases, GetTables, GetColumns, etc.
Then, for each DBMS it supported, all we had to do was create a class that
implemented the interface (SqlDatabaseInfo, AccessDatabaseInfo). Makes
things easier...and all you have to do is pass the class instance as the
interface around and call those methods :)

HTH,
Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top