SISTEM INFORMASI PENDATAAN PERPUSTAKAAN PADA PERPUSTAKAAN DAERAH SUMATERA UTARA MENGGUNAKAN VB.NET 2008
langkah pertama desain lha database mengguna kan microsoft office access 2003
di dalam satu folder kemudian letak kan d local C
dimana database nya seperti gambar di bawah ini
kemudian desain lha form seperti d bawah ini;
LISTING PROGRAM
Public Class Form1
Private Sub BARANGToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
BARANGToolStripMenuItem.Click
BARANG.Show()
BARANG.MdiParent = Me
End Sub
Private Sub STAFToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
STAFToolStripMenuItem.Click
STAF.Show()
STAF.MdiParent = Me
End Sub
Private Sub RUANGANToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
RUANGANToolStripMenuItem.Click
RUANGAN.Show()
RUANGAN.MdiParent = Me
End Sub
Private Sub INVENTORISToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
INVENTORISToolStripMenuItem.Click
INVENTARIS.Show()
INVENTARIS.MdiParent = Me
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 LBARANGToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LBARANGToolStripMenuItem.Click
Form2.Show()
Form2.MdiParent = Me
Dim
laporan As New
CrystalReport1
Form2.CrystalReportViewer1.ReportSource
= laporan
End Sub
Private Sub LSTAFToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LSTAFToolStripMenuItem.Click
Form3.Show()
Form3.MdiParent = Me
Dim
LAPORAN As New
CachedCrystalReport2
Form3.CrystalReportViewer1.ReportSource
= LAPORAN
End Sub
Private Sub LRUANGANToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LRUANGANToolStripMenuItem.Click
Form4.Show()
Form4.MdiParent = Me
Dim
Laporan As New
CachedCrystalReport3
Form4.CrystalReportViewer1.ReportSource
= Laporan
End Sub
Private Sub LINVENTORISToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LINVENTORISToolStripMenuItem.Click
Form5.MdiParent = Me
Form5.Show()
End Sub
Private Sub LAPRELASIToolStripMenuItem_Click(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
LAPRELASIToolStripMenuItem.Click
Form6.MdiParent = Me
Form6.Show()
Dim
LAPORAN As New
CrystalReport5
Form6.CrystalReportViewer1.ReportSource
= LAPORAN
End Sub
End Class
LISTING MODULE
Imports System.Data.OleDb
Module Module1
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:\HERI\BARANG.mdb"
DB = New OleDbConnection(LOKASI)
If DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub tampilRecord(ByVal namatabel As String, ByVal obj As DataGridView)
ADP = New OleDbDataAdapter("select * from " & namatabel, DB)
DS = New DataSet
ADP.Fill(DS, namatabel)
obj.DataSource = DS.Tables(namatabel)
End Sub
Sub clearfrom(ByVal from As Form)
Dim ctrl As Control
Dim txtcontrol As TextBox
Dim cmbcontrol As ComboBox
For Each ctrl In from.Controls
If TypeOf ctrl Is TextBox Then
txtcontrol = ctrl
txtcontrol.Text = ""
ElseIf TypeOf ctrl Is ComboBox Then
cmbcontrol = ctrl
cmbcontrol.Text = ""
End If
Next
End Sub
End Module
FORM BARANG
LISTING PROGRAM BARANG
Imports
System.Data.OleDb
Public Class BARANG
Dim SQL As String
Sub
butoonbaru()
baru.Enabled = True
simpan.Enabled = False
edit.Enabled = False
batal.Enabled = False
hapus.Enabled = False
keluar.Enabled = True
End Sub
Sub
butoonedit()
baru.Enabled = False
simpan.Enabled = False
edit.Enabled = True
batal.Enabled = True
hapus.Enabled = True
keluar.Enabled = False
End Sub
Sub
butoonsimpan()
baru.Enabled = False
simpan.Enabled = True
edit.Enabled = False
batal.Enabled = False
hapus.Enabled = True
keluar.Enabled = False
End Sub
Private Sub keluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles keluar.Click
Me.Close()
End Sub
Sub
hapustext()
clearfrom(Me)
Call
butoonbaru()
End Sub
Private Sub BARANG_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
tampilRecord("BARANG",
DataGridView1)
End Sub
Sub
prosesdb(ByVal aktifitas As Byte)
Select Case aktifitas
Case
0
SQL = "UPDATE
BARANG SET NAMA_B='" & TextBox2.Text & "'," & _
"JENIS='"
& TextBox3.Text & "',"
& _
"JUMLAH='" & TextBox4.Text & "'," & _
"SUMBER_P='" & TextBox5.Text & "'," & _
"TAHUN_P='" & TextBox6.Text & "' " & _
"Where
KODE_B ='" & TextBox1.Text & "'"
Case
1
SQL = "INSERT
INTO BARANG (KODE_B, NAMA_B, JENIS, JUMLAH, SUMBER_P, TAHUN_P)"
& _
"Values
('" & TextBox1.Text & "','"
& _
TextBox2.Text
& "','" & _
TextBox3.Text
& "','" & _
TextBox4.Text
& "','" & _
TextBox5.Text
& "','" & _
TextBox6.Text & "')"
Case
2
SQL = "DELETE
FROM BARANG Where KODE_B='" & TextBox1.Text & "'"
End Select
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
hapustext()
Call
tampilRecord("BARANG",
DataGridView1)
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 barang Where KODE_B='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
TextBox2.Text = DR.Item(2)
TextBox3.Text = DR.Item(3)
TextBox4.Text = DR.Item(4)
TextBox5.Text = DR.Item(5)
TextBox6.Text = DR.Item(6)
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 baru_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles baru.Click
Call
hapustext()
TextBox1.Focus()
End Sub
Private Sub batal_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles batal.Click
Call
hapustext()
TextBox1.Focus()
End Sub
Private Sub simpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles simpan.Click
Call
prosesdb(1)
End Sub
Private Sub edit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles edit.Click
Call
prosesdb(0)
End Sub
Private Sub hapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hapus.Click
Call
prosesdb(2)
End Sub
End Class
LAPORAN BARANG
FROM STAF
LISTING PROGRAM
Imports
System.Data.OleDb
Public Class STAF
Dim SQL As String
Sub
butoonbaru()
baru.Enabled = True
simpan.Enabled = False
edit.Enabled = False
batal.Enabled = False
hapus.Enabled = False
keluar.Enabled = True
End Sub
Sub
butoonedit()
baru.Enabled = False
simpan.Enabled = False
edit.Enabled = True
batal.Enabled = True
hapus.Enabled = True
keluar.Enabled = False
End Sub
Sub
butoonsimpan()
baru.Enabled = False
simpan.Enabled = True
edit.Enabled = False
batal.Enabled = False
hapus.Enabled = True
keluar.Enabled = False
End Sub
Private Sub keluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles keluar.Click
Me.Close()
End Sub
Sub
HAPUSTEXT()
clearfrom(Me)
Call
butoonbaru()
End Sub
Private Sub STAF_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
tampilRecord("STAF",
DataGridView1)
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 STAF Where KODE_S='" & 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
Sub
prosesdb(ByVal aktifitas As Byte)
Select Case aktifitas
Case
0
SQL = "UPDATE
STAF SET NAMA_S='" & TextBox2.Text & "' " & _
"Where
KODE_S ='" & TextBox1.Text & "'"
Case
1
SQL = "INSERT
INTO STAF (KODE_S, NAMA_S)" & _
"Values
('" & TextBox1.Text & "','"
& _
TextBox2.Text & "')"
Case
2
SQL = "DELETE
FROM STAF Where KODE_S='" & TextBox1.Text & "'"
End Select
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
hapustext()
Call
tampilRecord("STAF",
DataGridView1)
End Sub
Private Sub baru_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles baru.Click
Call
HAPUSTEXT()
TextBox1.Focus()
End Sub
Private Sub batal_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles batal.Click
Call
HAPUSTEXT()
TextBox1.Focus()
End Sub
Private Sub simpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles simpan.Click
Call
prosesdb(1)
End Sub
Private Sub edit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles edit.Click
Call
prosesdb(0)
End Sub
Private Sub hapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hapus.Click
Call
prosesdb(2)
End Sub
End Class
LAPORAN STAF
FORM RUANGAN
LISTING PROGRAM
Imports
System.Data.OleDb
Public Class RUANGAN
Dim SQL As String
Sub
butoonbaru()
baru.Enabled = True
simpan.Enabled = False
edit.Enabled = False
batal.Enabled = False
hapus.Enabled = False
keluar.Enabled = True
End Sub
Sub
butoonedit()
baru.Enabled = False
simpan.Enabled = False
edit.Enabled = True
batal.Enabled = True
hapus.Enabled = True
keluar.Enabled = False
End Sub
Sub
butoonsimpan()
baru.Enabled = False
simpan.Enabled = True
edit.Enabled = False
batal.Enabled = False
hapus.Enabled = True
keluar.Enabled = False
End Sub
Sub
HAPUSTEXT()
Call
clearfrom(Me)
Call
butoonbaru()
End Sub
Private Sub keluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles keluar.Click
Me.Close()
End Sub
Private Sub RUANGAN_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
tampilRecord("RUANGAN",
DataGridView1)
End Sub
Sub
prosesdb(ByVal aktifitas As Byte)
Select Case aktifitas
Case
0
SQL = "UPDATE
RUANGAN SET NAMA_R='" & TextBox2.Text & "' " & _
"Where
KODE_R ='" & TextBox1.Text & "'"
Case
1
SQL = "INSERT
INTO RUANGAN (KODE_R, NAMA_R)" & _
"Values
('" & TextBox1.Text & "','"
& _
TextBox2.Text & "')"
Case
2
SQL = "DELETE
FROM RUANGAN Where KODE_R='" & TextBox1.Text & "'"
End Select
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call hapustext()
Call
tampilRecord("RUANGAN",
DataGridView1)
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 RUANGAN Where KODE_R='" & 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 baru_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles baru.Click
Call
HAPUSTEXT()
TextBox1.Focus()
End Sub
Private Sub simpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles simpan.Click
Call
prosesdb(1)
End Sub
Private Sub hapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hapus.Click
Call
prosesdb(2)
End Sub
Private Sub edit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles edit.Click
Call
prosesdb(0)
End Sub
Private Sub batal_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles batal.Click
Call
HAPUSTEXT()
TextBox1.Focus()
End Sub
End Class
LAPORAN RUANGAN
FORM INVENTORIS
LISTING PROGRAM
Imports
System.Data.OleDb
Public Class INVENTARIS
Dim SQL As String
Sub
butoonbaru()
baru.Enabled = True
simpan.Enabled = False
edit.Enabled = False
batal.Enabled = False
hapus.Enabled = False
keluar.Enabled = True
End Sub
Sub
butoonedit()
baru.Enabled = False
simpan.Enabled = False
edit.Enabled = True
batal.Enabled = True
hapus.Enabled = True
keluar.Enabled = False
End Sub
Sub
butoonsimpan()
baru.Enabled = False
simpan.Enabled = True
edit.Enabled = False
batal.Enabled = False
hapus.Enabled = True
keluar.Enabled = False
End Sub
Private Sub keluar_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles keluar.Click
Me.Close()
End Sub
Private Sub INVENTARIS_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OPENDB()
Call
tampilRecord("INVENTARIS", DataGridView1)
End Sub
Sub
HAPUSTEXT()
clearfrom(Me)
Call
butoonbaru()
End Sub
Sub
prosesdb(ByVal aktifitas As Byte)
Select Case aktifitas
Case
0
SQL = "UPDATE
INVENTARIS SET KODE_B='" & ComboBox1.Text & "'," & _
"NAMA_B='" & TextBox2.Text & "'," & _
"KODE_R='" & ComboBox2.Text & "'," & _
"NAMA_R='" & TextBox3.Text & "'," & _
"KONDISI='"
& TextBox4.Text & "',"
& _
"JUMLAH='" & TextBox5.Text & "' " & _
"Where
NO_INVEN ='" & TextBox1.Text & "'"
Case
1
SQL = "INSERT
INTO INVENTARIS (NO_INVEN, KODE_B, NAMA_B, KODE_R, NAMA_R, KONDISI,
JUMLAH)" & _
"Values
('" & TextBox1.Text & "','"
& _
ComboBox1.Text
& "','" & _
TextBox2.Text
& "','" & _
ComboBox2.Text
& "','" & _
TextBox3.Text
& "','" & _
TextBox4.Text
& "','" & _
TextBox5.Text
& "')"
Case
2
SQL = "DELETE
FROM INVENTARIS Where NO_INVEN='" & TextBox1.Text & "'"
End Select
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
hapustext()
Call
tampilRecord("INVENTARIS",
DataGridView1)
End Sub
Private Sub TextBox1_KeyPress1(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 INVENTARIS Where NO_INVEN='" & TextBox1.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
ComboBox1.Text = DR.Item(2)
TextBox2.Text = DR.Item(3)
ComboBox2.Text = DR.Item(4)
TextBox3.Text = DR.Item(5)
TextBox4.Text = DR.Item(6)
TextBox5.Text = DR.Item(7)
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 baru_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles baru.Click
Call
HAPUSTEXT()
TextBox1.Focus()
End Sub
Private Sub batal_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles batal.Click
Call
HAPUSTEXT()
TextBox1.Focus()
End Sub
Private Sub simpan_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles simpan.Click
Call
prosesdb(1)
End Sub
Private Sub edit_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles edit.Click
Call
prosesdb(0)
End Sub
Private Sub hapus_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles hapus.Click
Call
prosesdb(2)
End Sub
End Class
LAPORAN INVENTORIS
LAPORAN RELASI