Public Class Form31A_36109013
Dim dt As New DataTable
Dim ny As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub fany()
Dim fa As New OleDb.OleDbDataAdapter
fa = New OleDb.OleDbDataAdapter("select * from barang", ny)
dt.Rows.Clear()
fa.Fill(dt)
fa.Dispose()
End Sub
Private Sub Form31A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fany()
dgv.DataSource = dt
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Form31B_36109013.Visible = False Then
Form31B_36109013.Show()
Else
Form31B_36109013.Activate()
End If
Form31B_36109013.KBlama36109013.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form31B_36109013.kb36109013.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form31B_36109013.nb36109013.Text = dgv.CurrentRow.Cells("namabarang").Value
Form31B_36109013.hj36109013.Text = dgv.CurrentRow.Cells("hargajual").Value
Form31B_36109013.jb36109013.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form31B_36109013.Show()
End Sub
End Class
Public Class Form31B_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109013.Click
If kb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If kb36109013.Text <> KBlama36109013.Text Then
fany.AturPencarianDataBase("Barang", "KodeBarang", kb36109013.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb36109013.Text & "', namabarang = '" & nb36109013.Text & "', hargajual = " & Val(hj36109013.Text) & ", jumlahbarang = " & Val(jb36109013.Text) & " where kodebarang = '" & KBlama36109013.Text & "'", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
kb36109013.Text = ""
nb36109013.Text = ""
hj36109013.Text = ""
jb36109013.Text = ""
KBlama36109013.Text = "-"
Form31A_36109013.fany()
End Sub
End Class
Public Class Form32A_36109013
Dim dt As New DataTable
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub fany()
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select * from barang", fa)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
End Sub
Private Sub Form32A_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fany()
dgv36109013.DataSource = dt
End Sub
Private Sub tambah36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah36109013.Click
If Form32B_36109013.Visible = False Then
Form32B_36109013.Show()
Else
Form32B_36109013.Activate()
End If
End Sub
Private Sub edit36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit36109013.Click
If Form32C_36109013.Visible = False Then
Form32C_36109013.Show()
Else
Form32C_36109013.Activate()
End If
Form32C_36109013.kb36109013.Text = dgv36109013.CurrentRow.Cells("kodebarang").Value
Form32C_36109013.nb36109013.Text = dgv36109013.CurrentRow.Cells("namabarang").Value
Form32C_36109013.hj36109013.Text = dgv36109013.CurrentRow.Cells("hargajual").Value
Form32C_36109013.jb36109013.Text = dgv36109013.CurrentRow.Cells("jumlahbarang").Value
Form32C_36109013.kblama36109013.Text = dgv36109013.CurrentRow.Cells("kodebarang").Value
Form32C_36109013.Show()
End Sub
End Class
Public Class Form32B_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109013.Click
If kb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
fany.AturPencarianDataBase("Barang", "KodeBarang", kb36109013.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb36109013.Text & "','" & nb36109013.Text & "'," & Val(hj36109013.Text) & "," & Val(jb36109013.Text) & ")", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
kb36109013.Text = ""
nb36109013.Text = ""
hj36109013.Text = ""
jb36109013.Text = ""
Form32A_36109013.fany()
End Sub
End Class
Public Class Form32C_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109013.Click
If kblama36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If kb36109013.Text <> kblama36109013.Text Then
fany.AturPencarianDataBase("Barang", "KodeBarang", kb36109013.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb36109013.Text & "', namabarang = '" & nb36109013.Text & "', hargajual = " & Val(hj36109013.Text) & ", jumlahbarang = " & Val(jb36109013.Text) & " where kodebarang = '" & kblama36109013.Text & "'", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
kb36109013.Text = ""
nb36109013.Text = ""
hj36109013.Text = ""
jb36109013.Text = ""
kblama36109013.Text = ""
Form32A_36109013.fany()
End Sub
End Class
Public Class Form33A_36109013
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim fah As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub fany()
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select * from barang", fah)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
End Sub
Private Sub Form33A_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fany()
dgv.DataSource = dt
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
cm = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv.CurrentRow.Cells("kodebarang").Value & "'", fah)
fah.Open()
cm.ExecuteNonQuery()
fah.Close()
cm.Dispose()
fany()
End Sub
Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
If Form33B_36109013.Visible = False Then
Form33B_36109013.Show()
Else
Form33B_36109013.Activate()
End If
Form33B_36109013.KDB.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form33B_36109013.NB.Text = dgv.CurrentRow.Cells("namabarang").Value
Form33B_36109013.HJ.Text = dgv.CurrentRow.Cells("hargajual").Value
Form33B_36109013.JB.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form33B_36109013.KBlama36109013.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form33B_36109013.Show()
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Form33B_36109013.Visible = False Then
Form33B_36109013.Show()
Else
Form33B_36109013.Activate()
End If
Form33B_36109013.KDB.Text = ""
Form33B_36109013.NB.Text = ""
Form33B_36109013.HJ.Text = ""
Form33B_36109013.JB.Text = ""
Form33B_36109013.KBlama36109013.Text = "-"
End Sub
End Class
Public Class Form33B_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub indonesia()
If KDB.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If NB.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(HJ.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(JB.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
End Sub
Private Sub tambah()
indonesia()
fany.AturPencarianDataBase("Barang", "KodeBarang", KDB.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & KDB.Text & "','" & NB.Text & "'," & Val(HJ.Text) & "," & Val(JB.Text) & ")", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
KDB.Text = ""
NB.Text = ""
HJ.Text = ""
JB.Text = ""
Form33A_36109013.fany()
End Sub
Private Sub edit()
indonesia()
If KDB.Text <> KBlama36109013.Text Then
fany.AturPencarianDataBase("Barang", "KodeBarang", KDB.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & KDB.Text & "', namabarang = '" & NB.Text & "', hargajual = " & Val(HJ.Text) & ", jumlahbarang = " & Val(JB.Text) & " where kodebarang = '" & KBlama36109013.Text & "'", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
KDB.Text = ""
NB.Text = ""
HJ.Text = ""
JB.Text = ""
KBlama36109013.Text = "-"
Form33A_36109013.fany()
End Sub
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
If KBlama36109013.Text = "-" Then
No comments:
Post a Comment