In every programming language, you need to create a database connection first before working on Create, Read, Update, Delete, Search (CRUDS) applicatioin. In this tutorial, I teach you on how to create MySQL Connection in VB.Net.
Requirements:
Step 1 - In your solution, add a new Module and named it with your desired database connection name. In my case I named my module as "db_conn".
Step 2 - Right-click your module and select view code.
Step 3 - Copy the code below and insert it into your db_conn module. It is recommended that you understand the database details. The server, database name, port, user id, and password.
Requirements:
- Add MySQL.data Reference to your solotion
- Add Imports MySql.Data.MySqlClient code above your module.
Step 1 - In your solution, add a new Module and named it with your desired database connection name. In my case I named my module as "db_conn".
Step 2 - Right-click your module and select view code.
Step 3 - Copy the code below and insert it into your db_conn module. It is recommended that you understand the database details. The server, database name, port, user id, and password.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public conn As New MySqlConnection("Server=localhost;" & _ | |
"Database=your_database;" & _ | |
"Port=3306;" & _ | |
"User=root;" & _ | |
"Password=your_password") |
0 Comments