March 22, 2012 at 10:05 am
I know that the following will load all of the String Names (i.e. all instances of SQL Server) into my ComboBox ...
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL");
foreach (var v in key.GetValueNames())
{
KAELCcomboBox1.Items.Add(v);
}
When I select an option from the dropdown box I can then assign that to a string variable named mySQL.
However, if there is only one instance of SQL Server on the PC and I know that, how do I select that single String Name and save that to mySQL ?
March 22, 2012 at 1:35 pm
Sorted ... mySQL = key.GetValueNames().First();
gary.p.heath (3/22/2012)
I know that the following will load all of the String Names (i.e. all instances of SQL Server) into my ComboBox ...
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL");
foreach (var v in key.GetValueNames())
{
KAELCcomboBox1.Items.Add(v);
}
When I select an option from the dropdown box I can then assign that to a string variable named mySQL.
However, if there is only one instance of SQL Server on the PC and I know that, how do I select that single String Name and save that to mySQL ?
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy