Public Class Form27_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim ny 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, ny)
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) & ")", ny)
ny.Open()
cm.ExecuteNonQuery()
ny.Close()
cm.Dispose()
KB36109013.Text = ""
NB36109013.Text = ""
HJ36109013.Text = ""
JB36109013.Text = ""
End Sub
End Class
Public Class Form28A_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 fah As New OleDb.OleDbDataAdapter
fah = New OleDb.OleDbDataAdapter("select * from barang", ny)
dt.Rows.Clear()
fah.Fill(dt)
fah.Dispose()
End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fany()
dgv.DataSource = dt
End Sub
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles input.Click
If Form28B_36109013.Visible = False Then
Form28B_36109013.Show()
Else
Form28B_36109013.Activate()
End If
End Sub
Private Sub tutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tutup.Click
Close()
End Sub
End Class
Public Class Form28B_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim ny As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
If KB.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
fany.AturPencarianDataBase("Barang", "KodeBarang", KB.Text, 1, ny)
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 ('" & KB.Text & "','" & NB.Text & "'," & Val(HJ.Text) & "," & Val(JB.Text) & ")", ny)
ny.Open()
cm.ExecuteNonQuery()
ny.Close()
cm.Dispose()
KB.Text = ""
NB.Text = ""
HJ.Text = ""
JB.Text = ""
Form28A_36109013.fany()
End Sub
End Class
Public Class Form29_36109013
Dim cm As New OleDb.OleDbCommand
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim ny As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
If kb2.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
If kb.Text <> kb2.Text Then
fany.AturPencarianDataBase("Barang", "KodeBarang", kb2.Text, 1, ny)
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 = '" & kb2.Text & "', namabarang = '" & nb.Text & "', hargajual = " & Val(hj.Text) & ", jumlahbarang = " & Val(jb.Text) & " where kodebarang = '" & kb.Text & "'", ny)
ny.Open()
cm.ExecuteNonQuery()
ny.Close()
cm.Dispose()
kb.Text = ""
kb2.Text = ""
nb.Text = ""
hj.Text = ""
jb.Text = ""
End Sub
End Class
Public Class Form30A_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 Form30A_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 Form30B_36109013.Visible = False Then
Form30B_36109013.Show()
Else
Form30B_36109013.Activate()
End If
Form30B_36109013.kb.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form30B_36109013.kb2.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form30B_36109013.nb.Text = dgv.CurrentRow.Cells("namabarang").Value
Form30B_36109013.hj.Text = dgv.CurrentRow.Cells("hargajual").Value
Form30B_36109013.jb.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form30B_36109013.Show()
End Sub
End Class
Public Class Form30B_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 simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
If kb2.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
If kb.Text <> kb2.Text Then
fany.AturPencarianDataBase("Barang", "KodeBarang", kb2.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 = '" & kb2.Text & "', namabarang = '" & nb.Text & "', hargajual = " & Val(hj.Text) & ", jumlahbarang = " & Val(jb.Text) & " where kodebarang = '" & kb.Text & "'", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
kb.Text = ""
kb2.Text = ""
nb.Text = ""
hj.Text = ""
jb.Text = ""
Form30A_36109013.fany()
End Sub
End Class
No comments:
Post a Comment