Form1 Odbcconnection Odbccommand Dataset Odbcdataadapter Odbcdatareader
Form1 Odbcconnection Odbccommand Dataset Odbcdataadapter Odbcdatareader
Form1 Odbcconnection Odbccommand Dataset Odbcdataadapter Odbcdatareader
Odbc
Public Class Form1
Dim CONN As OdbcConnection
Dim CMD As OdbcCommand
Dim DS As New DataSet
Dim DA As OdbcDataAdapter
Dim RD As OdbcDataReader
Dim LokasiData As String
Sub Koneksi()
LokasiData = "Driver={MySQL ODBC 3.51
Driver};Database=data_inventaris01;server=localhost;uid=root"
CONN = New OdbcConnection(LokasiData)
If CONN.State = ConnectionState.Closed Then
CONN.Open()
End If
End Sub
Sub TampilGrid()
Call Koneksi()
DA = New OdbcDataAdapter("select * From tbl_barang ", CONN)
DS = New DataSet
DA.Fill(DS, "tbl_barang")
DataGridView1.DataSource = DS.Tables("tbl_barang")
DataGridView1.ReadOnly = True
End Sub
Sub KosongkanData()
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Me.Close()
End Sub
End Sub
koneksiku = "server=localhost;uid=root;pwd='';database='data_inventaris01'"
Try
conn.ConnectionString = koneksiku
conn.Open()
MsgBox("koneksi berhasil", MsgBoxStyle.Information, "informasi")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class