I have programmed with Sql server for some months but I usually pass "(local)" or "localhost" into the sqlconnection string. Now I need to connect to a specified server and I guess I have to pass a Sql Server name into the connection string. But I didn't care what the names were when I installed Sqlserver. Could you please let me know how to view those names again? I also want to list all the server names on my computer and I have googled for hours but the results still confuse me. Some ones suggest using Registry but I can only find INSTANCES of sql server not server names, some ones suggest using SQLSMO but can it list all server names for me?(or only instances) (I haven't tried this yet), some ones suggest using SqlDataSourceEnumerator class but I have tested it without any expected result, Microsoft says it can work sometimes not always and I think it is helpless to me.
Could you please dissect the methods above or give me any other solutions?
Your helps would be highly appreciated!
Thank you very much!