SISTEM INFORMASI PEMESANAN
DAN PENJUALAN SUKU CADANG MOBIL UD.STAR DIESEL
Data base menggunakan
Microsoft Accses...
NO
|
FIELD NAME
|
DATA TYPE
|
SIZE
|
DEC
|
DESCRIPTION
|
1
|
Kode Barang
|
Text
|
25
|
Yes
|
Kode Barang
|
2
|
Jenis
|
Text
|
35
|
Yes
|
Jenis
|
3
|
Satuan
|
Text
|
35
|
Yes
|
Satuan
|
4
|
Jumlah
|
Currency
|
10
|
Yes
|
Jumlah
|
5
|
Harga
|
Int
|
3
|
Yes
|
Harga
|
Desaign Visual Basic...
Listing Program...
Imports
System.Data.OleDb
Public Class Form1
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:\DATA\barang.mdb"
DB = New
OleDbConnection(LOKASI)
If
DB.State = ConnectionState.Closed Then
DB.Open()
End If
End Sub
Sub
TampilRecordbarang()
ADP = New
OleDbDataAdapter("SELECT * FROM barang",
DB)
DS = New
DataSet
ADP.Fill(DS, "barang")
DataGridView1.DataSource = DS.Tables("barang")
End Sub
Sub
ButtonBaru()
BR.Enabled = True
SMPN.Enabled = False
EDIT.Enabled = False
HPS.Enabled = False
BTL.Enabled = False
KLR.Enabled = True
End Sub
Sub
ButtonEdit()
BR.Enabled = False
SMPN.Enabled = False
EDIT.Enabled = True
HPS.Enabled = True
BTL.Enabled = True
KLR.Enabled = False
End Sub
Sub
ButtonSimpan()
BR.Enabled = False
SMPN.Enabled = True
EDIT.Enabled = False
HPS.Enabled = False
BTL.Enabled = True
KLR.Enabled = False
End Sub
Sub
HapusText()
KODE.Text = ""
JNS.Text = "'"
SATUAN.Text = ""
HRG.Text = ""
JMLH.Text = ""
Call
ButtonBaru()
End Sub
Private Sub KLR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles KLR.Click
Me.Close()
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Call
OpenDB()
Call
HapusText()
Call
TampilRecordbarang()
End Sub
Private Sub BR_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BR.Click
Call
HapusText()
KODE.Focus()
End Sub
Private Sub KODE_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
KODE.KeyPress
Dim
tombol As Integer
= Asc(e.KeyChar)
Dim
xkode As String
If
tombol = 13 Then
SQL = "SELECT
* FROM barang Where kodebarang='" & KODE.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
DR = CMD.ExecuteReader
DR.Read()
If
DR.HasRows = True Then
JNS.Text = DR.Item(1)
SATUAN.Text = DR.Item(2)
HRG.Text = DR.Item(3)
JMLH.Text = DR.Item(4)
Call
ButtonEdit()
MsgBox("Data
ditemukan!")
Else
xkode = KODE.Text
Call
HapusText()
KODE.Text = xkode
Call
ButtonSimpan()
End
If
JNS.Focus()
End If
End Sub
Private Sub BTL_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles BTL.Click
Call
HapusText()
KODE.Focus()
End Sub
Private Sub HPS_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles HPS.Click
SQL = "DELETE
FROM barang Where kodebarang='" & KODE.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
TampilRecordbarang()
End Sub
Private Sub EDIT_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles EDIT.Click
SQL = "UPDATE
barang SET jenisbarang='" & JNS.Text & "'," & _
"
satuan='" & SATUAN.Text & "',"
& _
"
jumlahstok='" & JMLH.Text & "',"
& _
"
harga='" & HRG.Text & "'
" & _
"
Where kodebarang='" & KODE.Text & "'"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
TampilRecordbarang()
End Sub
Private Sub SMPN_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles SMPN.Click
SQL = "INSERT
INTO barang(kodebarang, jenisbarang, satuan, jumlahstok, harga) "
& _
"
values('" & KODE.Text & "','"
& _
JNS.Text
& "','" & _
SATUAN.Text & "','"
& _
JMLH.Text
& "','" & _
HRG.Text
& "')"
CMD = New
OleDbCommand(SQL, DB)
CMD.ExecuteNonQuery()
Call
BR_Click(sender, e)
Call
TampilRecordbarang()
End Sub
End Class
0 komentar:
Posting Komentar