Click here to Skip to main content
15,797,721 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
DataTable table = SqlDataSourceEnumerator.Instance.GetDataSources();
           foreach (DataRow server in table.Rows)
           {
               foreach (DataColumn col in table.Columns)
               {
                   cmbshowallsqlserver.Items.Add(string.Format("{0}\\{1}", server[table.Columns["ServerName"]], server[table.Columns["InstanceName"]]));
               }
           }

this code show computer name and sqlserver name but in my computer not show sqlserver names!
Posted
Comments
ZurdoDev 1-May-13 14:55pm    
Do you have SQL on your computer?
Bernhard Hiller 2-May-13 3:35am    
If you have an SQL server installation on your machine, did you set an Instance name? Perhaps the Instance name is just empty, instead of COMPUTERNAME\\SQLEXPRESS...

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