Entis Sutisna

Senin, 07 Maret 2016

Contoh koneksi data base di vb menggunakan MYSQL

Imports System.Data.Odbc
Module koneksi
    Public conn As OdbcConnection
    Public cmd As New OdbcCommand
    Public ds As New DataSet
    Public da As OdbcDataAdapter
    Public dr As OdbcDataReader
    Public sql As String
    Public lokasi As String

    Public Sub koneksidb()
        lokasi = "Driver={MySQL ODBC 5.1 Driver};server=localhost;uid=root;database=aplikasikurikulumentis"
        conn = New OdbcConnection(lokasi)
        If conn.State = ConnectionState.Closed Then
            conn.Open()
        End If
    End Sub
End Module

Lihat dulu sob nama databasenya dan jangan lupa kamu harus pasang dulu konektornya dan sesuaikan yang kamu instal
semoga bermanfaat ! :)                                                                                                                                                                         

0 komentar:

Posting Komentar