0% found this document useful (0 votes)
23 views

Coding

This document contains code for connecting to a MySQL database in VB.NET. It defines a Module that declares connection, command, data reader, and data adapter objects for MySQL, and includes a method to open the connection to a MySQL server named localhost using the root username and an empty password to access a database called klinik. It also contains a second Module that defines the same objects but for an ODBC connection to a DSN called klinik on the same server and database.

Uploaded by

ITech Indo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views

Coding

This document contains code for connecting to a MySQL database in VB.NET. It defines a Module that declares connection, command, data reader, and data adapter objects for MySQL, and includes a method to open the connection to a MySQL server named localhost using the root username and an empty password to access a database called klinik. It also contains a second Module that defines the same objects but for an ODBC connection to a DSN called klinik on the same server and database.

Uploaded by

ITech Indo
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Imports MySql.Data.

MySqlClient
Module Moduleklinik
Public conn As MySqlConnection
Public cmd As MySqlCommand
Public dr As MySqlDataReader
Public da As MySqlDataAdapter
Public ds As DataSet
Public simpan, ubah, hapus As String

Pubilc Sub bukaDB()


Dim SQLconn As String
SQLconn = "server=localhost;Userid=root;Password=;Database=klinik"
conn = New MySqlConnection(SQLconn)
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
End Sub
End Module

Imports System.Data.Odbc
Module Moduleklinik
Public conn As OdbcConnection
Public cmd As OdbcCommand
Public dr As OdbcDataReader
Public da As OdbcDataAdapter`
Public ds As DataSet
Public str As String

Public Sub koneksi()


conn = New
OdbcConnection("DSNklinik;database=klinik;option=0;port=0;server=localhost;uid=root")
conn.Open()

End Sub
End Module

You might also like