I have installed MySQL 8.0.19 and create a database named as login_db. Next, I made a login form in VB Net (VS 2019) and trying to make a connection MySQL database by creating an open connection module:
Imports System.Data.SqlClient
Module ModuleConnection
Public connection As SqlConnection ' declaration our connection
' function fo connection
Sub OpenConnection()
Try
connection = New SqlConnection(" ")
If connection.State = ConnectionState.Closed Then
connection.Open() ' open the connection
End If
Catch ex As Exception
' if failed
MsgBox("Failed to connect, Error at " & ex.ToString)
End Try
End Sub
End Module
My problem is writing the correct syntax in 'connection = New SqlConnection(" ")'. The connection details as follow:
Service name: MySQL80 Running on: localhost Database name: login_db
How to connect to my database using 'connection = New SqlConnection(" ")'?
Aucun commentaire:
Enregistrer un commentaire