0% found this document useful (0 votes)
46 views2 pages

Listing Program Search

This document describes a program that allows users to search and view employee data from a database table. The program loads employee ID numbers into a dropdown list. When an ID is selected, text boxes are populated with the corresponding employee name, department, job title, and status from the database. Users can also click a button to display all data for the selected employee in a read-only datagrid. The program connects to the database, builds SQL queries to retrieve employee data by ID, and displays the results in the user interface.

Uploaded by

Rona Veriansyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views2 pages

Listing Program Search

This document describes a program that allows users to search and view employee data from a database table. The program loads employee ID numbers into a dropdown list. When an ID is selected, text boxes are populated with the corresponding employee name, department, job title, and status from the database. Users can also click a button to display all data for the selected employee in a read-only datagrid. The program connects to the database, builds SQL queries to retrieve employee data by ID, and displays the results in the user interface.

Uploaded by

Rona Veriansyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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

You might also like