locked
mysql connector RRS feed

  • Question

  • User-1260064810 posted

    My mysql database and iis are on two servers.  I installed Mysql connector for windows 6.9.3.  Now, I am lost what to do next.  Searching the web doesn't help much.  Can someone point a right direction for me?

    Tuesday, September 23, 2014 5:03 PM

Answers

  • User281315223 posted

    If you are using Visual Studio, you might want to consider installing the MySQL for Visual Studio, as I believe it will have many of the tools necessary to work with MySQL databases and to access them.

    With regards the connectors, I believe that you'll just need to add a reference to the DLL that should have come with your MySQL download to your project. This should provide you with the necessary classes to build your MySqlConnection objects which will reference your connection string to your database :

    using(MySqlConnection connection = new MySqlConnection("Your Connection String"))
    {
         // Build your query
         var query = "SELECT * FROM YourTable";
    
         using(MySqlCommand command = new MySqlCommand(query,connection))   
         {
                // Open your connection
                connection.Open();
    
                // Execute your query
                using(MySqlDataReader reader = command.ExecuteReader())
                {
                        // Read through your rows here
                }
         }
    }

    If you are looking for a step-by-step walkthrough or tutorial, you might consider checking out the MySQL .NET Developer's Guide here.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 23, 2014 5:14 PM

All replies

  • User281315223 posted

    If you are using Visual Studio, you might want to consider installing the MySQL for Visual Studio, as I believe it will have many of the tools necessary to work with MySQL databases and to access them.

    With regards the connectors, I believe that you'll just need to add a reference to the DLL that should have come with your MySQL download to your project. This should provide you with the necessary classes to build your MySqlConnection objects which will reference your connection string to your database :

    using(MySqlConnection connection = new MySqlConnection("Your Connection String"))
    {
         // Build your query
         var query = "SELECT * FROM YourTable";
    
         using(MySqlCommand command = new MySqlCommand(query,connection))   
         {
                // Open your connection
                connection.Open();
    
                // Execute your query
                using(MySqlDataReader reader = command.ExecuteReader())
                {
                        // Read through your rows here
                }
         }
    }

    If you are looking for a step-by-step walkthrough or tutorial, you might consider checking out the MySQL .NET Developer's Guide here.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, September 23, 2014 5:14 PM
  • User-1260064810 posted

    I just installed mysql connector for visual studio, and it works exactly as I want.  Thanks.

    Wednesday, October 1, 2014 12:50 PM