How to Connect MySQL To Visual Studio 2019 | 2020 Complete Guide


How to Connect MySQL To Visual Studio 2019

This is a Complete Guide on How to Connect MySQL To Visual Studio 2019 where you will learn how to manipulate MySQL Database using different VS versions.

In this tutorial on how to connect MySQL Database to visual studio .NET you will be introduced to the best practices on how to manipulate MySQL data using VB.NET.

Before we begin, watch here first the video on how to connect access database to application to get some ideas on the foregoing paragraph.

Anyway if you have not yet installed visual studio 2013, 2015, 2017 or 2019 version, you can download the visual studio here.

How to Connect MySQL to Visual Studio 2019

  1. Open Visual Studio

    You can you use visual studio 2015, 2017 or 2019 for this tutorial.

  2. Create a VB.Net Project.

    File New Project->Under Templates Select Visual Basic or Visual C#. as shown in the image below.
    create with visual studio 2019

  3. Add Reference

    Right Click Solution Explorer ->Click Add -> Select Reference.
    add reference visual studio 2019

  4. Select from your recent Tab.

    On the reference Manager, Click Browse / Recent the Select the
    See the complete guide here on how to add in visual studio.
    reference manager

  5. Add Import above Public Class.

    imports to visual studio 2019

  6. Setup Connection String

    Under public class Form1, Add the following declaration and Connectionstring.
    setup connection string in visual studio 2019

  7. Test the connection String.

    test Connection String visual studio

  8. Run your Project.

    Press F5 or simply click the Start Debugging.
    database connected

VB.Net Code to Connect MySQL to Visual Studio.

Load MySQL record in Visual Studio 2019

In this section, we are going to load a record from MySQL Database in VB.Net Application using Visual Studio 2019.

Step by step instructions on how to Load MySQL Record in VB.Net

Step 1: Create a table in the MySQL database. To do this, execute the SQL code below.

Step 2: Add 1 button to Form1 and 1 Datagridview1. Then Arrange it similar in the image below.

Step 3: Then Double click the “Load Record” Button and add the following code.

Step 5: Press F5 to test the project. When you execute the program and click the Load record button. You will see a result that looks as shown below.

Here’s a sample Code on how to Insert Record in MySQL using VB.Net using Visual Studio 2019.

You check here on how to add multiple records in to MySQL Database.

Updating of Records

Here’s a sample Code on how to Update MySQL Database in VB.Net using Visual Studio 2019.

Deleting of Records from MySQL Database

Here’s a sample Code on how to Delete Record in MySQL using VB.Net using Visual Studio 2019.

After you complete this tutorial, you will be able to develop your own personalized projects.

You can watch here the complete video tutorial on how to master VB.Net with MySQL Database.


In summary, we have discussed here how to connect MySQL to visual studio 2019. Next, we also learn how to load the Mysql record from the database using VB.Net. Then, we have given also a code on how to Insert, Update and Delete Record from MySQL using VB.Net 2019.


If you have any questions or suggestions about this tutorial on how to connect MySQL to Visual Studio 2019 or using different versions, please leave a comment below.

Looking for more source code? Type your keyword here here!


  1. This is a very good source of information…It is hard to research for all this info in the web…here is the more comprehensive and very much useful peice of information. It is very hard to find this in books and other tutorial sites…i dont know why…this is a very important lesson…specially if you don’t have someone to guide you and you are in your own in learning in programming and data science…thank you sir…


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.