Public Class Form32A_36109023
Dim ame As New DataTable
Dim mm As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub amelia()
Dim cc As New OleDb.OleDbDataAdapter
cc = New OleDb.OleDbDataAdapter("select * from barang", mm)
ame.Rows.Clear()
cc.Fill(ame)
cc.Dispose()
End Sub
Private Sub Form32A_36109023_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
amelia()
dgv36109023.DataSource = ame
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Form32B_36109023.Visible = False Then
Form32B_36109023.Show()
Else
Form32B_36109023.Activate()
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Form32C_36109023.Visible = False Then
Form32C_36109023.Show()
Else
Form32C_36109023.Activate()
End If
Form32C_36109023.t1_36109023.Text = dgv36109023.CurrentRow.Cells("kodebarang").Value
Form32C_36109023.t2_36109023.Text = dgv36109023.CurrentRow.Cells("namabarang").Value
Form32C_36109023.t3_36109023.Text = dgv36109023.CurrentRow.Cells("hargajual").Value
Form32C_36109023.t4_36109023.Text = dgv36109023.CurrentRow.Cells("jumlahbarang").Value
Form32C_36109023.KB36109023.Text = dgv36109023.CurrentRow.Cells("kodebarang").Value
Form32C_36109023.Show()
End Sub
End Class
Public Class Form32B_36109023
Dim amelia As New ByIskandar.CariKeDataBaseByIskandar
Dim ame As New OleDb.OleDbCommand
Dim mm As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub t5_36109023_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t5_36109023.Click
If t1_36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
amelia.AturPencarianDataBase("Barang", "KodeBarang", t1_36109023.Text, 1, mm)
If amelia.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
ame = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109023.Text & "','" & t2_36109023.Text & "'," & Val(t3_36109023.Text) & "," & Val(t4_36109023.Text) & ")", mm)
mm.Open()
ame.ExecuteNonQuery()
mm.Close()
ame.Dispose()
t1_36109023.Text = ""
t2_36109023.Text = ""
t3_36109023.Text = ""
t4_36109023.Text = ""
Form32A_36109023.amelia()
End Sub
End Class
Public Class Form32C_36109023
Dim amelia As New ByIskandar.CariKeDataBaseByIskandar
Dim ame As New OleDb.OleDbCommand
Dim mm As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If t1_36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109023.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109023.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t1_36109023.Text <> t4_36109023.Text Then
amelia.AturPencarianDataBase("Barang", "KodeBarang", t1_36109023.Text, 1, mm)
If amelia.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
ame = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109023.Text & "', namabarang = '" & t2_36109023.Text & "', hargajual = " & Val(t3_36109023.Text) & ", jumlahbarang = " & Val(t4_36109023.Text) & " where kodebarang = '" & KB36109023.Text & "'", mm)
mm.Open()
ame.ExecuteNonQuery()
mm.Close()
ame.Dispose()
t1_36109023.Text = ""
t2_36109023.Text = ""
t3_36109023.Text = ""
t4_36109023.Text = ""
KB36109023.Text = ""
Form32A_36109023.amelia()
End Sub
End Class
0 komentar:
Posting Komentar