Solved

MySQL How do I enumerate a list of servers

Posted on 2013-06-24
4
408 Views
Last Modified: 2013-06-25
I have to convert a VB 2010 application from SQL Server to MySQL. One thin this program does the first time it run is to check for a SQL installation. If it does not fine one it then installs SQL Server. I need that to happen with MySQL, So my question is what is the MySQL equivalent to System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources.

Thanks
Art
0
Comment
Question by:Nashua58
  • 2
  • 2
4 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 39274049
GetDataSources return visible SQL Server instances in the whole network, do u want to do the same with MySql?
or just look for the client machine and if no instance is running then install MySql?
0
 

Author Comment

by:Nashua58
ID: 39274460
Hi Sedgwick

I would really like just the client machine.

Thanks
0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 39274466
string query = "SELECT * FROM Win32_Product WHERE Name LIKE '%MySQL%'";

            var s = new ManagementObjectSearcher("root\\CIMV2", query);
            foreach (ManagementObject service in s.Get())
            {
                // show the instance 
                Console.WriteLine(service.ToString());

            } 

Open in new window

0
 

Author Closing Comment

by:Nashua58
ID: 39276619
Thank you so much this is just what I was looking for. Out of curiosity how would you accomplish this if you were looking over the entire network?

Art
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question