Click here to Skip to main content
15,903,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Dynamically give sql connection through form...and after that want to bind all databases present in a sql to dropdownlist
Posted
Updated 17-Jun-11 3:15am
v2

I really don't understand the first part of your question, but assuming all of the possible servers are accessed the same way, all you really have to do is ask for a server machine (and maybe instance), and credentials (if applicable). Then a simple string substitution in the connection string with the specified data should get you where you want to gpo.

Getting a list of all tables in the connected database:

SQL
SELECT * FROM information_schema.tables


Whether you use a stored proc or a simple query from your C# code is completely up to you.
 
Share this answer
 
You need to read up on SQL Server SMO objects[^]

SQL SMO Examples[^]
 
Share this answer
 
we can connect to sql server
using System.Data.SqlClient;

SqlConnection class - which is resposible to open & close connection to sql server
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900