Grabbing tables and databases from SQL2000 using C#

D

Dizzzz

I am creating a front end that will access a SQL database and I want
to create a DROP DOWN control that will display the databases and
tables available from a SQL2000 server. Much like the one in the
Import/Export menus in SQL2000 Enterprise Manager.

Does anyone know the class in C# to do that? I can connect fine, I
just want to display the tables and db's.

If I am asking for the wrong thing, by all means, straighten me out
and put me down the proper path. TIA!!

Dizzzzz
 
J

John Baro

I have done this in the past using the sysobjects and sysdatabases tables.
sysObjects contains information on objects in the current db.
sysDatabases contains info on dbs in the server and is contained in *master*
HTH
JB
 
J

J P Deka

Just use these stored procedures

sp_databases
sp_tables '%'
sp_columns '%table_name%'

make a command object and execute the query and get the result isn
datareader object or Dataset.
 
I

Ignacio Machin

Hi,

In SQL 2K you have an SP that query those tables: sp_databases, it return
the name of the DB as well as the size of it.

Hope this help,
 

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