LANGKAH PERTAMA BUAT LHA DATABASE MENGGUNAKAN MICROSOFT ACCESS
DI DALAM SATU BASE TAPI BEBERAPA TABEL DI DALAM NYA SEPERTI DI BAWAH INI;
MESRAN.NER
KEMUDIAN DESAIN LHA FROM MENU SEPERTI DI BAWAH INI
SETELAH SELESAI DI DESAIN KLIK MENU UTAMA LIHAT PROPERTIES PILIH ISMDICONTAINER JADI TRUE KEMUIAN WINDOWSTATE JADI MASINIZED
KEMUDIAN LISTING PROGRAM DI BAWAH INI;
SETELAH ITU DESAIN LHA FROM KARYAWAN SEPERTI DI BAWAH INI;
SETELAH SELESAI MENDESAIN FROM KARYAWAN KEMUDIAN LISTING KAN LHA PROGRAM SEPERTI DIBAWAH INI DI BAWAH INI;
SETELAH SELESAI LISTING KAN LHA PROGRAM DI ATAS MAKA KITA AKAN MASUK KE FROM BAGIAN DIMANA KITA TERLEBIH DAHULU DESAIN FROM NYA SEPERTI DI BAWAH INI;
SETELAH KITA SELESAI DESAIN FROM DI ATAS MAKA KITA LISTINGKAN PROGRAM DI BAWAH INI;
SETELAH SELESAI LISTING KAN LHA PROGRAM DI ATAS MAKA KITA AKAN MASUK KE FROM JABATAN DIMANA KITA TERLEBIH DAHULU DI ANJUR KAN DESAIN FROM NYA SEPERTI DI BAWAH INI;
KEMUDIAN KITA LISTINGKAN PROGRAM DI BAWAH INI;
NAH SEKARANG SUDAH SELESAI MENDESAIN DAN LISTING KAN PROGRAM DI ATAS COBA ANDA JALAN KAN APAKAH SEPERTI DIBAWAH INI HASIL NYA,,
KALAU TIDAK SAMA HASIL NYA MAKA COBA ANDA LIHAT DULU PROGRAM YANG ANDA BUAT,,,,,
SEKIAN DAN TERIMA KASIH SEMOGA BERMAMFAAT BUAT KITA SEMUA NYA,
BYE BYE BYE BYE BYE BYE BYE BYE BYE BYE BYE BYE
DI DALAM SATU BASE TAPI BEBERAPA TABEL DI DALAM NYA SEPERTI DI BAWAH INI;
MESRAN.NER
KEMUDIAN DESAIN LHA FROM MENU SEPERTI DI BAWAH INI
SETELAH SELESAI DI DESAIN KLIK MENU UTAMA LIHAT PROPERTIES PILIH ISMDICONTAINER JADI TRUE KEMUIAN WINDOWSTATE JADI MASINIZED
KEMUDIAN LISTING PROGRAM DI BAWAH INI;
Public Class Form1
Private Sub KARYAWANToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KARYAWANToolStripMenuItem.Click
KARYAWAN.MdiParent = Me
KARYAWAN.Show()
End Sub
Private Sub BAGIANToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
BAGIANToolStripMenuItem.Click
BAGIAN.MdiParent = Me
BAGIAN.Show()
End Sub
Private Sub JABATANToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
JABATANToolStripMenuItem.Click
JABATAN.MdiParent = Me
JABATAN.Show()
End Sub
Private Sub KELUARToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
KELUARToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub FILEToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
FILEToolStripMenuItem.Click
End Sub
End Class
SETELAH ITU DESAIN LHA FROM KARYAWAN SEPERTI DI BAWAH INI;
SETELAH SELESAI MENDESAIN FROM KARYAWAN KEMUDIAN LISTING KAN LHA PROGRAM SEPERTI DIBAWAH INI DI BAWAH INI;
Imports
System.Data.OleDb
Public Class KARYAWAN
Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OPENDB()
Dim
LOKASI = "Provider =
Microsoft.Jet.OLEDB.4.0;Data Source=C:\VB6\DATABASE141.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
RecordKARYAWAN()
ADP = New
OleDbDataAdapter("SELECT * FROM KARYAWAN",
DB)
DS = New
DataSet
ADP.Fill(DS, "KARYAWAN")
DataGridView1.DataSource = DS.Tables("KARYAWAN")
End Sub
Sub
butoonbaru()
Button1.Enabled = True
Button2.Enabled = False
Button3.Enabled = False
Button4.Enabled = False
Button5.Enabled = False
Button6.Enabled = True
End Sub
Sub
butoonedit()
Button1.Enabled = False
Button2.Enabled = False
Button3.Enabled = True
Button4.Enabled = True
Button5.Enabled = True
Button6.Enabled = False
End Sub
Sub
butoonsimpan()
Button1.Enabled = False
Button2.Enabled = True
Button3.Enabled = False
Button4.Enabled = False
Button5.Enabled = True
Button6.Enabled = False
End Sub
Sub
hapustext()
TextBox1.Text = ""
TextBox2.Text = ""
ComboBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
ComboBox1.Text = ""
Call
butoonbaru()
End Sub
Sub
recordjabatan()
ComboBox2.Items.Clear()
SQL = "SELECT
* FROM KD_JABATAN "
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
While
DR.Read
ComboBox2.Items.Add(DR("KD_JABATAN"))
End While
DR.Close()
End Sub
Private Sub KARYAWAN_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
RecordKARYAWAN()
Call
hapustext()
Call
Recordjabatan()
ComboBox1.Items.Add("JENIS KELAMIN")
End Sub
Private Sub Button6_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
Me.Close()
End Sub
Private Sub TextBox1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
TextBox1.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
Dim xkd
As String
If
tombol = 13 Then
SQL = "SELECT
* FROM KARYAWAN Where NIK='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
TextBox2.Text = DR.Item(2)
xkd = DR.Item(3)
TextBox4.Text = DR.Item(5)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = TextBox1.Text
Call
hapustext()
TextBox1.Text = xkode
Call
butoonsimpan()
End
If
DR.Close()
TextBox2.Focus()
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button5_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
Call
hapustext()
TextBox1.Focus()
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Call
hapustext()
TextBox1.Focus()
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
SQL = "INSERT
INTO KARYAWAN (NIK, NAMA, JABATAN, J_KELAMIN, BAGIAN)" & _
"Values
('" & TextBox1.Text & "','"
& _
TextBox2.Text
& "','" & _
ComboBox2.Text & "','" & _
TextBox3.Text
& "','" & _
ComboBox1.Text
& "','" & _
TextBox4.Text
& "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordKARYAWAN()
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
SQL = "UPDATE
KARYAWAN SET NAMA='" & TextBox2.Text & "'," & _
"JABATAN='" & TextBox3.Text & "'," & _
"J_KELAMIN='" & ComboBox1.Text &
"'," & _
"BAGIAN='" & TextBox4.Text & "' " & _
"Where NIK='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordKARYAWAN()
Call
hapustext()
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
ComboBox1.SelectedIndexChanged
If
ComboBox1.Text = "JENIS KELAMIN" Then
ComboBox1.Items.Add("LAKI-LAKI")
ComboBox1.Items.Add("PEREMPUAN")
ComboBox1.Items.Add("WARIA")
End If
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
SQL = "DELETE
FROM KARYAWAN Where NIK='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordKARYAWAN()
End Sub
Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object,
ByVal e As
System.EventArgs) Handles
ComboBox2.SelectedIndexChanged
SQL = "SELECT
* FROM KD_JABATAN Where KD_JABATAN='" & ComboBox2.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
If
DR.HasRows Then
DR.Read()
TextBox3.Text = DR("NM_JABATAN")
End If
End Sub
End Class
SETELAH SELESAI LISTING KAN LHA PROGRAM DI ATAS MAKA KITA AKAN MASUK KE FROM BAGIAN DIMANA KITA TERLEBIH DAHULU DESAIN FROM NYA SEPERTI DI BAWAH INI;
SETELAH KITA SELESAI DESAIN FROM DI ATAS MAKA KITA LISTINGKAN PROGRAM DI BAWAH INI;
Imports
System.Data.OleDb
Public Class BAGIAN
Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OPENDB()
Dim
LOKASI = "Provider =
Microsoft.Jet.OLEDB.4.0;Data Source=C:\VB6\DATABASE141.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
RecordBAGIAN()
ADP = New
OleDbDataAdapter("SELECT * FROM BAGIAN",
DB)
DS = New
DataSet
ADP.Fill(DS, "BAGIAN")
DataGridView1.DataSource = DS.Tables("BAGIAN")
End Sub
Sub
butoonbaru()
Button1.Enabled = True
Button2.Enabled = False
Button3.Enabled = False
Button4.Enabled = False
Button5.Enabled = False
Button6.Enabled = True
End Sub
Sub
butoonedit()
Button1.Enabled = False
Button2.Enabled = False
Button3.Enabled = True
Button4.Enabled = True
Button5.Enabled = True
Button6.Enabled = False
End Sub
Sub
butoonsimpan()
Button1.Enabled = False
Button2.Enabled = True
Button3.Enabled = False
Button4.Enabled = False
Button5.Enabled = True
Button6.Enabled = False
End Sub
Sub
hapustext()
TextBox1.Text = ""
TextBox2.Text = ""
Call
butoonbaru()
End Sub
Private Sub BAGIAN_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
hapustext()
Call
RecordBAGIAN()
End Sub
Private Sub TextBox1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
TextBox1.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM BAGIAN Where KD_BAGIAN='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
TextBox2.Text = DR.Item(2)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = TextBox1.Text
Call
hapustext()
TextBox1.Text = xkode
Call
butoonsimpan()
End
If
TextBox2.Focus()
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
SQL = "UPDATE
BAGIAN SET NN_BAGIAN='" & TextBox2.Text & "' " & _
"Where KD_BAGIAN ='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordBAGIAN()
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Call
hapustext()
TextBox1.Focus()
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
SQL = "INSERT
INTO BAGIAN (KD_BAGIAN, NN_BAGIAN)" & _
"Values
('" & TextBox1.Text & "','"
& _
TextBox2.Text
& "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordBAGIAN()
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
SQL = "DELETE
FROM BAGIAN Where KD_BAGIAN='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordBAGIAN()
End Sub
Private Sub Button5_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
Call
hapustext()
TextBox1.Focus()
End Sub
Private Sub Button6_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
Me.Close()
End Sub
End Class
SETELAH SELESAI LISTING KAN LHA PROGRAM DI ATAS MAKA KITA AKAN MASUK KE FROM JABATAN DIMANA KITA TERLEBIH DAHULU DI ANJUR KAN DESAIN FROM NYA SEPERTI DI BAWAH INI;
KEMUDIAN KITA LISTINGKAN PROGRAM DI BAWAH INI;
Imports
System.Data.OleDb
Public Class JABATAN
Public DB As OleDbConnection
Public CMD As OleDbCommand
Public ADP As OleDbDataAdapter
Public DR As OleDbDataReader
Public DS As New DataSet
Dim SQL As String
Public Sub OPENDB()
Dim
LOKASI = "Provider =
Microsoft.Jet.OLEDB.4.0;Data Source=C:\VB6\DATABASE141.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
RecordJABATAN()
ADP = New
OleDbDataAdapter("SELECT * FROM
KD_JABATAN", DB)
DS = New
DataSet
ADP.Fill(DS, "KD_JABATAN")
DataGridView1.DataSource = DS.Tables("KD_JABATAN")
End Sub
Sub
butoonbaru()
Button1.Enabled = True
Button2.Enabled = False
Button3.Enabled = False
Button4.Enabled = False
Button5.Enabled = False
Button6.Enabled = True
End Sub
Sub
butoonedit()
Button1.Enabled = False
Button2.Enabled = False
Button3.Enabled = True
Button4.Enabled = True
Button5.Enabled = True
Button6.Enabled = False
End Sub
Sub
butoonsimpan()
Button1.Enabled = False
Button2.Enabled = True
Button3.Enabled = False
Button4.Enabled = False
Button5.Enabled = True
Button6.Enabled = False
End Sub
Sub
hapustext()
TextBox1.Text = ""
TextBox2.Text = ""
Call
butoonbaru()
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
SQL = "DELETE
FROM KD_JABATAN Where KD_JABATAN='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordJABATAN()
End Sub
Private Sub JABATAN_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
hapustext()
Call
RecordJABATAN()
End Sub
Private Sub TextBox1_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
TextBox1.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM KD_JABATAN Where KD_JABATAN='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
TextBox2.Text = DR.Item(2)
Call
butoonedit()
MsgBox("DATA
DITEMUKAN!")
Else
xkode = TextBox1.Text
Call
hapustext()
TextBox1.Text = xkode
Call
butoonsimpan()
End
If
TextBox2.Focus()
End If
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
SQL = "UPDATE
KD_JABATAN SET NM_JABATAN='" & TextBox2.Text & "' " & _
"Where KD_JABATAN ='" &
TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordJABATAN()
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Call
hapustext()
TextBox1.Focus()
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
SQL = "INSERT
INTO KD_JABATAN (KD_JABATAN, NM_JABATAN)" & _
"Values
('" & TextBox1.Text & "','"
& _
TextBox2.Text & "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
Button1_Click(sender, e)
Call
RecordJABATAN()
End Sub
Private Sub Button5_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
Call
hapustext()
TextBox1.Focus()
End Sub
Private Sub Button6_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button6.Click
Me.Close()
End Sub
End Class
NAH SEKARANG SUDAH SELESAI MENDESAIN DAN LISTING KAN PROGRAM DI ATAS COBA ANDA JALAN KAN APAKAH SEPERTI DIBAWAH INI HASIL NYA,,
KALAU TIDAK SAMA HASIL NYA MAKA COBA ANDA LIHAT DULU PROGRAM YANG ANDA BUAT,,,,,
SEKIAN DAN TERIMA KASIH SEMOGA BERMAMFAAT BUAT KITA SEMUA NYA,
BYE BYE BYE BYE BYE BYE BYE BYE BYE BYE BYE BYE
Komentar ini telah dihapus oleh pengarang.
BalasHapusThanks gan infonya .. Sekalian ijin share ya gan :D
BalasHapusBagi kalian mahasiswa Teknik Informatika yang membutuhkan Source Code Contoh Program Penggajian Pegawai ataupun yang lainnya, kalian dapat membelinya di www.SkripVb.com dengan harga yang sangat terjangkau, programnya lengkap dengan database dan contoh datanya sehingga kalian tinggal menggunakannya saja dan diterapkan pada makalah yang sedang kalian tulis. Source Code programnya juga dapat kalian modifikasi lagi dan kalian dapat mengembangkannya lagi sesuai dengan makalah yang sedang kalian tulis.
Untuk lebih jelasnya silahkan kunjungi www.SkripVb.com
Apa yang Anda cari kami adalah solusinya.
itu kodingnya kalau udh di masukkan, bisa jalan gk program nya om....
BalasHapus