Form1 Oledbconnection Oledbdataadapter Oledbcommand Oledbdatareader Oledbdatareader Dataset
Form1 Oledbconnection Oledbdataadapter Oledbcommand Oledbdatareader Oledbdatareader Dataset
Imports System.Data.OleDb
Public Class Form1
Dim cn As OleDbConnection
Dim da As OleDbDataAdapter
Dim cmd As OleDbCommand
Dim rd As OleDbDataReader
Dim reader As OleDbDataReader
Dim ds As DataSet
End Sub
End Sub
Query = "Select * from Login Where Username='" & txtuser.Text & "' AND Password='" & txtpass.Text
& "'"
cmd = New OleDbCommand(Query, cn)
rd = cmd.ExecuteReader
If rd.HasRows Then
MsgBox("wellcome....")
Form2.Show()
Else
MsgBox("User atau Password Salah")
txtuser.Text = ""
txtpass.Text = ""
txtuser.Focus()
End If
End Sub
2. Form Loading
Public Class Form2
End Sub
Sub Tampil()
da = New OleDbDataAdapter("Select * from Biodata", cn)
ds = New DataSet
da.Fill(ds, "Biodata")
DGV.DataSource = ds.Tables("Biodata")
DGV.ReadOnly = True
End Sub
Sub Koneksi()
cn = New OleDbConnection("Provider=Microsoft.Ace.Oledb.12.0;Data Source=barang.Accdb")
If cn.State = ConnectionState.Closed Then
cn.Open()
End If
End Sub
Private Sub Frminput_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Call Koneksi()
Call Tampil()
Call Kosong()
End Sub
End Sub
End If
End Sub
End Class
Catch ex As Exception
MsgBox("Data gagal Diubah")
Call Kosong()
End Try
End If
End Sub
End If
End If
End Sub
End Class
Private Sub btncari_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btncari.Click
If ComboBox1.Text = "Kode Barang" Then
Call Koneksi()
cmd = New OleDbCommand("Select * from Biodata where kode_barang like '%" &
Txtcari.Text & "%'", cn)
rd = cmd.ExecuteReader
rd.Read()
If rd.HasRows Then
Call Koneksi()
da = New OleDbDataAdapter("Select * from Biodata where kode_barang like
'%" & Txtcari.Text & "%'", cn)
ds = New DataSet
da.Fill(ds, "Ketemu")
DGV.DataSource = ds.Tables("Ketemu")
DGV.ReadOnly = True
End If
End If
End Sub
End Class