User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 402,054 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,400 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 641 | Replies: 1
Reply
Join Date: Feb 2008
Posts: 68
Reputation: johnny.g is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 2
johnny.g johnny.g is offline Offline
Junior Poster in Training

populate dropdown list with table names

  #1  
Jun 18th, 2008
hi all,,,
well i am using asp.net 2005 and sql server 2005...
i hav a database called as ABC,,i am using a gridview and a dropdown list inmy application.
What i want is ,,the dropdown list should be populated wiyh all the table names available in ABC database and on the click of a submit button it the attributes of that table should be displayed in tht grid view.....
can ne1 help me out in solving ths prob,,,ASAP,,
thnks in advance
Johnny.G
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: India
Posts: 125
Reputation: bala24 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 11
bala24's Avatar
bala24 bala24 is offline Offline
Junior Poster

Re: populate dropdown list with table names

  #2  
Jun 18th, 2008
THe first part is easy.
You can get all the tables from the database through this query:
SELECT * FROM sysobjects WHERE type = 'U' 
Just populate the dropdown with the output from this query.

On selection of the dropdown, get all columns and display them in the grid.

This query will help you in this

select column_name from information_schema.columns
 where table_name = '<table name>'
order by ordinal_position 

Hope this helps!
Last edited by bala24 : Jun 18th, 2008 at 5:38 am.
Michelangelo

"The best place to find a helping hand is at the end of your own arm"
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 12:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC