SHARE
TWEET

Untitled

a guest Jul 16th, 2019 103 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports MySql.Data.MySqlClient.MySqlConnection
  2. Imports System.Data
  3. Module mdlKoneksi
  4.     '-- MySQL Connection
  5.     Public connDB As New MySql.Data.MySqlClient.MySqlConnection
  6.     Public comDB As New MySql.Data.MySqlClient.MySqlCommand
  7.     Public comBuilderDB As New MySql.Data.MySqlClient.MySqlCommandBuilder
  8.     Public rdDB As MySql.Data.MySqlClient.MySqlDataReader
  9.     Public da As MySql.Data.MySqlClient.MySqlDataAdapter
  10.     Public dt As New DataTable
  11.     Public myError As MySql.Data.MySqlClient.MySqlError
  12.     Public SQL As String
  13.     Public Item As ListViewItem
  14.     Public Sub conecDB()
  15.         'This is the connection for your MS SQL Server
  16.         'Dim strServer As String = ""    'This is the server IP/Server name.  If server is intalled on your local machine, your IP should be 127.0.0.1 or you may use localhost
  17.         Dim strServer As String = "localhost"
  18.         Dim strDbase As String = "test"   'Database name
  19.         Dim strUser As String = "test"   'Database user
  20.         Dim strPass As String = "abc123"         'Database password
  21.         'MySQL Connection String
  22.         If connDB.State <> ConnectionState.Open Then connDB.ConnectionString = "server=" & strServer.Trim & ";database=" & strDbase.Trim & ";user=" & strUser.Trim & ";password=" & strPass
  23.         If connDB.State <> ConnectionState.Open Then connDB.Open()
  24.     End Sub
  25.     'Close the connection from database
  26.     Public Sub closeDB()
  27.         If connDB.State <> ConnectionState.Closed Then connDB.Close()
  28.     End Sub
  29.     'Initialize the sql command object
  30.     Public Sub initCMD()
  31.         With comDB
  32.             .Connection = connDB
  33.             .CommandType = CommandType.Text
  34.             .CommandTimeout = 0
  35.         End With
  36.     End Sub
  37. End Module
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top