SISTEM INFORMASI PENDATAAN PERPUSTAKAAN PADA PERPUSTAKAAN DAERAH SUMATERA UTARA MENGGUNAKAN VB.NET 2008
QUIS ONLINE YANG MENURUT SAYA HAL YANG MENARIK JIKA DI JALANKAN
QUIS ONLINE YANG MENURUT SAYA HAL YANG MENARIK JIKA DI JALANKAN
YANG MANA DI DALAM SATU DATABASES TERDAPAT 3 TABEL
KEMUDIAN DESAIN LHA FROM MENU SEPERTI GAMBAR DI BAWA INI;
KEMUDIAN LISTING PROGRAM UNTUK MENU SEPERTI D BAWAH INI
Public Class Form1
Private Sub KeluarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KeluarToolStripMenuItem.Click
Me.Close()
End Sub
Private Sub FromBarangToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FromBarangToolStripMenuItem.Click
Form_barang.MdiParent = Me
Form_barang.Show()
End Sub
Private Sub FromInToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FromInToolStripMenuItem.Click
Form_inventaris.MdiParent = Me
Form_inventaris.Show()
End Sub
Private Sub FromRuanganToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FromRuanganToolStripMenuItem.Click
Form_ruangan.MdiParent = Me
Form_ruangan.Show()
End Sub
Private Sub FromStafToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FromStafToolStripMenuItem.Click
Form_Staf.MdiParent = Me
Form_Staf.Show()
End Sub
Private Sub LapBarangToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LapBarangToolStripMenuItem.Click
Laporan_Barang.Show()
End Sub
End Class
KEMUDIAN LISTING PROGRAM UNTUK BARANG SEPERTI DI BAWAH INI
Imports MySql.Data.MySqlClient
Public Class Form_barang
Public DB As New MySql.Data.MySqlClient.MySqlConnection
Public SQL As String
Public cmd As MySqlCommand
Public rs As MySqlDataReader
Public Sub Opendb()
SQL = "server=localhost;uid=root;pwd;database=pendataan_perpustakaan"
Try
DB.ConnectionString = SQL
DB.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Sub bersih()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End Sub
Sub RUBAHBUTTON(ByVal Btn1 As Boolean, ByVal Btn2 As Boolean, ByVal Btn3 As Boolean, ByVal Btn4 As Boolean, ByVal Btn5 As Boolean, ByVal Btn6 As Boolean)
baru.Enabled = Btn1
simpan.Enabled = Btn2
batal.Enabled = Btn3
hapus.Enabled = Btn4
edit.Enabled = Btn5
keluar.Enabled = Btn6
End Sub
Sub buattabel()
heri.Columns.Add("kode_brg", 80, HorizontalAlignment.Center)
heri.Columns.Add("nama_brg", 180, HorizontalAlignment.Left)
heri.Columns.Add("jenis", 80, HorizontalAlignment.Left)
heri.Columns.Add("jumlah", 80, HorizontalAlignment.Left)
heri.Columns.Add("sumber", 180, HorizontalAlignment.Left)
heri.Columns.Add("tahun", 80, HorizontalAlignment.Left)
heri.GridLines = True
heri.FullRowSelect = True
heri.View = View.Details
End Sub
Sub isitabel()
heri.Items.Clear()
SQL = "select * from barang"
cmd = New MySqlCommand(SQL, DB)
rs = cmd.ExecuteReader
Try
While rs.Read
Dim ist As New ListViewItem
ist.Text = rs("Kode_brg")
ist.SubItems.Add(rs("Nama_brg"))
ist.SubItems.Add(rs("jenis"))
ist.SubItems.Add(rs("jumlah"))
ist.SubItems.Add(rs("sumber"))
ist.SubItems.Add(rs("tahun"))
heri.Items.Add(ist)
End While
Catch ex As Exception
MsgBox(ex.Message)
End Try
rs.Close()
End Sub
Sub prosesdb(ByVal log As Integer)
Dim pesan As String = ""
Select Case log
Case 0
SQL = "insert into barang " & _
"values ('" & TextBox1.Text & _
"','" & TextBox2.Text & _
"','" & TextBox3.Text & _
"','" & TextBox4.Text & _
"','" & TextBox5.Text & _
"','" & TextBox6.Text & "')"
pesan = "data telah disimpan"
Case 1
SQL = "update barang set nama_brg='" & TextBox2.Text & "', " & _
"jenis='" & TextBox3.Text & "'," & _
"jumlah='" & TextBox4.Text & "'," & _
"sumber='" & TextBox5.Text & "'," & _
"tahun='" & TextBox6.Text & "'" & _
"where kode_brg='" & TextBox1.Text & "'"
pesan = "telah di update"
Case 2
SQL = "delete from barang where kode_brg='" & TextBox1.Text & "'"
pesan = "data telah dihapus"
End Select
Try
cmd = New MySqlCommand(SQL, DB)
cmd.ExecuteNonQuery()
MsgBox(pesan, MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "konfirmasi")
Call bersih()
Call isitabel()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Sub showdb()
rs.Read()
TextBox1.Text = rs("Kode_brg")
TextBox2.Text = rs("Nama_brg")
TextBox3.Text = rs("jenis")
TextBox4.Text = rs("jumlah")
TextBox5.Text = rs("sumber")
TextBox6.Text = rs("tahun")
RUBAHBUTTON(False, False, True, True, True, False)
edit.Text = ""
TextBox1.Enabled = False
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
Me.Close()
End Sub
Private Sub Form_barang_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Call Opendb()
Call bersih()
Call isitabel()
Call buattabel()
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)
If tombol = 13 Then
Dim x As String
If TextBox1.Text = "" Then
MsgBox("isi kode terlebih dahulu")
Else
SQL = "select* from barang where kode_brg='" & TextBox1.Text & "'"
cmd = New MySqlCommand(SQL, DB)
rs = cmd.ExecuteReader
Try
Call showdb()
Catch ex As Exception
x = TextBox1.Text
bersih()
TextBox1.Text = x
RUBAHBUTTON(True, True, False, False, False, True)
simpan.Text = "simpan"
End Try
TextBox2.Focus()
rs.Close()
End If
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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles baru.Click
Call bersih()
TextBox1.Focus()
End Sub
Private Sub batal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles batal.Click
Call bersih()
TextBox1.Focus()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
Dim x As String
x = MsgBox("anda yakin ingin menghapus", MsgBoxStyle.Information + MsgBoxStyle.YesNo, "hapus")
If x = vbYes Then
Call prosesdb(2)
End If
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
If simpan.Text = "simpan" Then prosesdb(0) Else prosesdb(1)
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If edit.Text = "edit" Then prosesdb(0) Else prosesdb(1)
End Sub
End Class
MAKA HASIL NYA AKAN SEPERTI DI BAWAH INI
NAH SEKARANG SAYA AKAN COBA MENJELAS KAN SEDIKIT DALAM PEMBUATAN SEBUAH LAPORAN MENGGUNAKAN MYSQL,
LANGKAH PETAMA INSTALL LHA TERLEBIH DAHULU MySQL ODBC Drivers 3.51
SUPAYA BISA DI BACA DARI PENYIMPANAN MYSQL NYA
KEMUDIAN DESAIN LHA LAPORAN NYA
SEPERTI GAMBAR DI BAWAH INI;
SETELAH KITA JALAN KAN AKAN SEPERTI GAMBAR DI BAWA INI LAPORAN BARANG NYA;
KEMUDIAN DESAIN FROM INVENTARIS SEPERTI DI BAWAH INI
KEMUDIAN DESAIN FROM RUANGAN SEPERTI DI BAWAH INI
KEMUDIAN DESAIN FROM STAF SEPERTI DI BAWAH INI
SELAMAT BELAJAR VB.NET
BY HERI SIANIPAR
Tidak ada komentar:
Posting Komentar