View Issue Details

IDProjectCategoryView StatusLast Update
0000190HeurekaOtherpublic2018-03-09 16:16
ReporterPeder Assigned ToLinus  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version2.10.2 
Target Version2.11.0 
Summary0000190: List all local SQL instances
DescriptionNär man ska ansluta en databas listas inte alla tillgängliga lokala SQL-Server instanser. Jag använder den här i Treesys-koden (hittade på nätet), den är mycket snabb:

public static IList<string> GetSqlServers()
        {
            var sqlServers = new List<string>();
            RegistryView registryView = Environment.Is64BitOperatingSystem
                ? RegistryView.Registry64
                : RegistryView.Registry32;
            using (RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, registryView))
            {
                RegistryKey instanceKey = hklm.OpenSubKey(
                    @"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL", false);
                if (instanceKey != null)
                {
                    foreach (var instanceName in instanceKey.GetValueNames())
                    {
                        sqlServers.Add(Environment.MachineName + @"\" + instanceName);
                    }
                }
            }
            return sqlServers;
        }
TagsNo tags attached.
ProductGeneral

Activities

Linus

2018-03-09 16:16

administrator   ~0000201

19046 - Implemented

Issue History

Date Modified Username Field Change
2018-02-26 08:13 Peder New Issue
2018-02-26 09:27 Peder Description Updated
2018-03-09 16:16 Linus Assigned To => Linus
2018-03-09 16:16 Linus Status new => closed
2018-03-09 16:16 Linus Resolution open => fixed
2018-03-09 16:16 Linus Note Added: 0000201