Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

SQL Server Connection String Utility

Need help to create a utility program that can simplify the configuration of the connection string for a client workstation to connect to a named instance of an SQL Server.  This utility must provide an extremely basic interface so as to be intuitive to even the most illiterate computer user - there would be a drop-down box listing all servers on the network.  Once the user selects the server with the "MYAPP" instance, the utility would read the selected data and add it to the app.config setting.  The DB password will be hard-coded into the app.  Need help with the design and coding of this tool.  Not sure how to "look" for available servers.
0
dev775
Asked:
dev775
  • 3
1 Solution
 
Gautham JanardhanCommented:
SQLDMO.Application app = new SQLDMO.ApplicationClass();
                  SQLDMO.NameList nameList = app.ListAvailableSQLServers();
                  for (int i=0; i<nameList.Count; i++)
                  {      
                        string srvName = nameList.Item(i + 1);
                        Console.WriteLine(srvName);    
                  }
0
 
Gautham JanardhanCommented:
add refernce -> Com - > SQL DMO Object
0
 
Gautham JanardhanCommented:
Microsoft SQLDMO Object Library
0
 
dev775Author Commented:
Ok, thanks.  I will give this a try.  May need a little more help after getting into it.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now