In my .NET application I am connecting to Microsoft SQL Server 2005 or 2008 database. User selects instance which the application shows it and then application should do something with this instance. I take instance names from the registry, HKLM\Software\Microsoft\Microsoft SQL Server\Instance Names\SQL.
I do not know if user selects default instance or named instance (and there is no such information in the Instance Names registry values). However, in order to connect to an arbitraty instance, I should use either
Server=(local) or Server=MSSQLSERVER\instance_name
in my ADO.NET connection string. Can I use only one connection string template? I tried to use Server=MSSQLSERVER\MSSQL10.MSSQLSERVER for my default SQL Server 2008 instance, but connection failed.