ANDI WAHYUNI
361 09 019
3A – D3
Public Class Form027_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni 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_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.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 ('" & t1_36109019.Text & "','" & t2_36109019.Text & "'," & Val(t3_36109019.Text) & "," & Val(t4_36109019.Text) & ")", uni)
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
End Sub
End Class
Public Class Form028A_36109019
Dim dt As New DataTable
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub wahyuni()
Dim fm As New OleDb.OleDbDataAdapter
fm = New OleDb.OleDbDataAdapter("select * from barang", uni)
dt.Rows.Clear()
fm.Fill(dt)
fm.Dispose()
End Sub
Private Sub Form028A_36109019_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wahyuni()
Dgv.DataSource = dt
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Form028B_36109019.Visible = False Then
Form028B_36109019.Show()
Else
Form028B_36109019.Activate()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
End Class
Public Class Form028B_36109019
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim uni 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_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.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 ('" & t1_36109019.Text & "','" & t2_36109019.Text & "'," & Val(t3_36109019.Text) & "," & Val(t4_36109019.Text) & ")", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
Form028A_36109019.wahyuni()
End Sub
End Class
Public Class Form029_36109019
Dim cm As New OleDb.OleDbCommand
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim uni 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_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109019.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If kb_36109019.Text <> t1_36109019.Text Then
wahyuni.AturPencarianDataBase("Barang", "KodeBarang", t1_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109019.Text & "', namabarang = '" & t2_36109019.Text & "', hargajual = " & Val(t3_36109019.Text) & ", jumlahbarang = " & Val(t4_36109019.Text) & " where kodebarang = '" & kb_36109019.Text & "'", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
cm.Dispose()
kb_36109019.Text = ""
t1_36109019.Text = ""
t2_36109019.Text = ""
t3_36109019.Text = ""
t4_36109019.Text = ""
End Sub
End Class
Public Class Form030A_36109019
Dim dt As New DataTable
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub wahyuni()
Dim fm As New OleDb.OleDbDataAdapter
fm = New OleDb.OleDbDataAdapter("select * from barang", uni)
dt.Rows.Clear()
fm.Fill(dt)
fm.Dispose()
End Sub
Private Sub Form030A_36109019_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wahyuni()
dgv.DataSource = dt
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Form030B_36109019.Visible = False Then
Form030B_36109019.Show()
Else
Form030B_36109019.Activate()
End If
Form030B_36109019.kb_36109019.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form030B_36109019.t1_36109019.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form030B_36109019.t2_36109019.Text = dgv.CurrentRow.Cells("namabarang").Value
Form030B_36109019.t3_36109019.Text = dgv.CurrentRow.Cells("hargajual").Value
Form030B_36109019.t4_36109019.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Tidak ada komentar:
Posting Komentar