Public Class Form27_36109023
Dim amelia As New ByIskandar.CariKeDataBaseByIskandar
Dim am As New OleDb.OleDbCommand
Dim ee As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE ='" & Application.StartupPath & "\DATABARANG.ACCDB'")
Private Sub simpan36109023_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109023.Click
If kode36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nama36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(harga36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jumlah36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
amelia.AturPencarianDataBase("Barang", "KodeBarang", kode36109023.Text, 1, ee)
If amelia.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
am = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kode36109023.Text & "','" & nama36109023.Text & "'," & Val(harga36109023.Text) & "," & Val(jumlah36109023.Text) & ")", ee)
ee.Open()
am.ExecuteNonQuery()
ee.Close()
am.Dispose()
kode36109023.Text = ""
nama36109023.Text = ""
harga36109023.Text = ""
jumlah36109023.Text = ""
End Sub
End Class
Public Class Form28A_36109023
Dim amelia As New DataTable
Dim aa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub rock()
Dim bb As New OleDb.OleDbDataAdapter
bb = New OleDb.OleDbDataAdapter("select * from barang", aa)
amelia.Rows.Clear()
bb.Fill(amelia)
bb.Dispose()
End Sub
Private Sub Form28A_36109023_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
rock()
dgv36109023.DataSource = amelia
End Sub
Private Sub Input36109023_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Input36109023.Click
If Form28B_36109023.Visible = False Then
Form28B_36109023.Show()
Else
Form28B_36109023.Activate()
End If
End Sub
Private Sub Tutup36109023_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tutup36109023.Click
Close()
End Sub
End Class
Public Class Form28B_36109023
Dim amelia As New ByIskandar.CariKeDataBaseByIskandar
Dim aa As New OleDb.OleDbCommand
Dim ee As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109023_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109023.Click
If kode36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nama36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(harga36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jumlah36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
amelia.AturPencarianDataBase("Barang", "KodeBarang", kode36109023.Text, 1, ee)
If amelia.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
aa = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kode36109023.Text & "','" & nama36109023.Text & "'," & Val(harga36109023.Text) & "," & Val(jumlah36109023.Text) & ")", ee)
ee.Open()
aa.ExecuteNonQuery()
ee.Close()
aa.Dispose()
kode36109023.Text = ""
nama36109023.Text = ""
harga36109023.Text = ""
jumlah36109023.Text = ""
End Sub
End Class
Public Class Form29_36109023
Dim aa As New OleDb.OleDbCommand
Dim amelia As New ByIskandar.CariKeDataBaseByIskandar
Dim bb As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109023_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109023.Click
If kode2_36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nama36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(harga36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jumlah36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If kode1_36109023.Text <> kode2_36109023.Text Then
amelia.AturPencarianDataBase("Barang", "KodeBarang", kode2_36109023.Text, 1, bb)
If amelia.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
aa = New OleDb.OleDbCommand("update barang set kodebarang = '" & kode2_36109023.Text & "', namabarang = '" & nama36109023.Text & "', hargajual = " & Val(jumlah36109023.Text) & ", jumlahbarang = " & Val(harga36109023.Text) & " where kodebarang = '" & kode1_36109023.Text & "'", bb)
bb.Open()
aa.ExecuteNonQuery()
bb.Close()
aa.Dispose()
kode1_36109023.Text = ""
kode2_36109023.Text = ""
nama36109023.Text = ""
harga36109023.Text = ""
jumlah36109023.Text = ""
End Sub
End Class
0 komentar:
Posting Komentar