Imports System
Imports System.IO
Imports System.Data
Imports MySql.Data.MySqlClient
Module modKoneksi
Public conn As New MySqlConnection
Public conn2 As New MySqlConnection
Public cmd As New MySqlCommand
Public cmd2 As New MySqlCommand
Public Sub connDb()
Dim db_nama1 As String
Dim db_server As String
Dim db_login1 As String
Dim db_password1 As String
Try
'db_server = IP-Address
db_nama1 = NamaDatabase
db_login1 = LoginDatabase
db_password1 = PasswordDatabase
LoginServerIP = db_server
LoginServerDb = db_nama1
conn.ConnectionString = "server=" & db_server _
& ";user id=" & db_login1 _
& ";password=" & db_password1 _
& ";database=" & db_nama1 _
& ";Convert Zero Datetime=" & True
'cmd.Connection = conn
'cmd2.Connection = conn
If conn.State = 0 Then
conn.Open()
Else
MsgBox("SERVER TIDAK DITEMUKAN!", vbExclamation, "Fatal error")
End If
Catch Err As Exception
MsgBox("Maaf, tidak ada koneksi", MsgBoxStyle.Information, Application.ProductName)
End
End Try
End Sub
Sub CloseConn()
If conn.State = 1 Then
conn.Close()
End If
End Sub
End Module
Module Koneksi
Langganan:
Posting Komentar (Atom)
0 comments:
Posting Komentar