Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I will Create a combobox that this listed sqlservers in self too udl file that I use from this file for test conection, but I will create a form for replace with udl file.
Thanks a lot for your answers.
Posted
Updated 3-Jan-11 21:44pm
v2
Comments
Sandeep Mewara 4-Jan-11 3:52am    
Not clear.

You can use Microsoft.SqlServer.Management.Smo.SmoApplication.EnumAvailableSqlServers(False) to Enumerate SQL server instances in network.
 
Share this answer
 
C#
..............................
OleDbConnection conn = null;
switch(itemValue){
case itemValue1:
   conn = new OleDbConnection("FileName="+System.Environment.CurrentDirectory+"filename1");
   break;
case itemValue2:
   conn = new OleDbConnection("FileName="+System.Environment.CurrentDirectory+"filename2");
  break;
default:
  break;
}
................

or
C#
DataTable dt = SqlClientFactory.Instance.CreateDataSourceEnumerator().GetDataSources();
 
Share this answer
 
v3

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