SQLServer Instance

Feb 22 2016 9:44 AM
Am trying to get a list of all sql sever instance(c#) in my network using this code but i get an empty list


var dt = SqlDataSourceEnumerator.Instance.GetDataSources();

to verify i put in CMD this "sqlcmd -L" and "osql -L" and i get the list.

so what am doing wrong, i dont know if OS matter am using Win10. Also someone know how to do this using dlls that sqlserver have?

thanks.

Answers (1)