Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: How to get the table names and column names of a table ?


Message #1 by "CMY" <my62202@y...> on Wed, 25 Sep 2002 03:37:23
Hi all,

Would like to get some help on the following problems. Thanks.

Let's say in my Northwind database, I have 2 user tables named Acc_Table 
and Product_Table.

I would like to retrieve this 2 tables name and bind it to my 
DropDownList so that when the user click on the drop down list, they can 
see this 2 tables names.

And also in this Acc_Table, it have say 3 columns named Acc_No, Acc_Name, 
Address.

So whenever a user choose a table from the drop down list, I will 
populate the respective column names in another DropDownList, so that 
they will know what are the columns available for a particular table.

I know that in MS SQL Server, we can do:
Select * from sysobjects where xtype = 'u'
to get all the user tables and also we can do:
Select * from syscolumns
to get all the column names.

I tried to do this in my code behind and then bind the result to my drop 
down list. But it does not work and always return me a -1.

Pls help and thanks a lot.

  Return to Index