Koneksi VB .Net Dengan Database Mysql
Untuk
yang ini anda harus install ODBC MySql terlebih dahulu yang selanjutnya
pada Project Anda Add Refernce lalu pilih ODBC MySql
Imports MySql.Data.MySqlClient
Module Module_koneksi
Dim connection As New MySqlClientConection("server=LOCALHOST; uid=UID; pwd=PASSWORD; database=NAMADATABASE")
Private Sub connection_open()
Try
If connection.State <> ConnectionState.Closed Then connection.Close()
connection.Open()
Catch ex As Exception
End Try
End Sub
Private Sub connection_close()
Try
If connection.State <> ConnectionState.Open Then connection.Open()
connection.Close()
Catch ex As Exception
End Try
End Sub
End Module
Comments
Post a Comment