Listing program search
Listing program
Imports System.Data.OleDb
Public Class FormSearch
Private Sub FormSearch_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
koneksi()
tampilkannik()
End Sub
Sub tampilkannik()
cmd = New OleDbCommand("Select NIK from tabelkaryawan ", con)
rd = cmd.ExecuteReader
Do While rd.Read
cbonik.Items.Add(rd.Item("NIK"))
Loop
End Sub
Private Sub cbonik_SelectedIndexChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles cbonik.SelectedIndexChanged
cmd = New OleDbCommand("Select NIK,Nama,Departement,Jabatan,Status
from tabelkaryawan where NIK='" & cbonik.Text & "'", con)
rd = cmd.ExecuteReader
rd.Read()
If rd.HasRows = True Then
txtnama.Text = rd.Item("Nama")
txtjabatan.Text = rd.Item("Jabatan")
txtstatus.Text = rd.Item("Status")
txtdept.Text = rd.Item("Departement")
1
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
koneksi()
cmd = New OleDbCommand("Select NIK,Nama,Departement,Jabatan,Status
from tabelkaryawan where NIK='" & cbonik.Text & "'", con)
rd = cmd.ExecuteReader
Do While rd.Read
ds = New DataSet
DataGridView1.DataSource = ds.Tables("tabelkaryawan")
DataGridView1.ReadOnly = True
Loop
End Sub
End Class