Grabbing tables and databases from SQL2000 using C#

  • Thread starter Thread starter Dizzzz
  • Start date Start date
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
 
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
 
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.
 
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,
 
Back
Top