Hi All,
I am new to C# and have been assigned to build a small application in C#. What I have to do is make a database connection and gather the list of available server-databases and then populate a checkedlist box with this list. Then I have to take a user input for a data object(which can be a stored proc or a view) and search for this user input in the list of stored procedures for the selected checkedlist box items (eg: if there is a server-db like datadev - base and the user input is sp_orders then I have to check for sp_orders in all the stored procs listed under datadev-base). when I am able to find the stored procs tht call the user input data object then I have to display them in a list box. So far I have been able to make a DB connection and populate the checkedlistbox. I am not sure how to procced now. All I have in mind is that I can search for the data object using 'ismatch' on the text that I can get thru executing 'helptext' on the stored procs. But I dont know how to code for it and where should this code go(Probably that would be in the clickevent of submit button after taking user input, if I am not wrong). I would really appreciate if anybody can help me with this.
Thanks,

Please Help!!
jca_john
To retrieve the list of databases on that SQL Connection:
you can execute the sp_databases stored procedure which will retrieve the list of databases on that connection.
so you can use a dataReader to read each row (column name Database_name) and populate this in a list box/combo box
you can also retrieve a list of stored procedures for the specific database using this query on the database:
select name from dbo.sysobjects where type ='P'
I hope this helps in some way!
renyx
Thanks to both of you,
I will try these codes and let you know what works for me.
biki
Another Solution differ from what Ahmed Suggest is to use
SMO (Server Management Objects)
To Use it first you need to do the following
Add The Reference To
Write
You Can do the Following
//To Connect To The Serevr
string serverName = "Localhost";
Server server = new Server(serverName);
Look Also To This Thread
How to add SQL ConnectionString editor form