MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
DatabaseInstanceQuery.cs
1using Microsoft.Win32;
2using System;
3using System.Collections.Generic;
4using System.Linq;
5using System.Text;
6using System.Threading.Tasks;
7
8namespace MyCaffe.db.image
9{
14 {
19 {
20 }
21
26 public static string GetInstancesAsText()
27 {
28 List<string> rgstr = GetInstances();
29 string strOut = "";
30
31 foreach (string str in rgstr)
32 {
33 strOut += str + "\n";
34 }
35
36 return strOut;
37 }
38
43 public static List<string> GetInstances()
44 {
45 RegistryKey baseKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
46 RegistryKey key = baseKey.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL");
47 List<string> rgstr = new List<string>();
48
49 if (key == null)
50 return rgstr;
51
52 foreach (string str in key.GetValueNames())
53 {
54 rgstr.Add(".\\" + str);
55 }
56
57 key.Close();
58 baseKey.Close();
59
60 return rgstr;
61 }
62 }
63}
The DatabaseInstanceQuery class is used to find all installed instances of SQL on a given machine.
static string GetInstancesAsText()
Returns a list of the SQL instances as a string.
static List< string > GetInstances()
Returns a list of the SQL instances as a list of strings.
The MyCaffe.db.image namespace contains all image database related classes.
Definition: Database.cs:18