Public Class Form30A_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 nn()
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 Form30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
nn()
dgv36109023.DataSource = amelia
End Sub
Private Sub edit36109023_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit36109023.Click
If Form30B_36109023.Visible = False Then
Form30B_36109023.Show()
Else
Form30B_36109023.Activate()
End If
Form30B_36109023.kb36109023.Text = dgv36109023.CurrentRow.Cells("kodebarang").Value
Form30B_36109023.t1_36109023.Text = dgv36109023.CurrentRow.Cells("kodebarang").Value
Form30B_36109023.t2_36109023.Text = dgv36109023.CurrentRow.Cells("namabarang").Value
Form30B_36109023.t3_36109023.Text = dgv36109023.CurrentRow.Cells("hargajual").Value
Form30B_36109023.t4_36109023.Text = dgv36109023.CurrentRow.Cells("jumlahbarang").Value
Form30B_36109023.Show()
End Sub
End Class
Public Class Form30B_36109023
Dim amelia As New ByIskandar.CariKeDataBaseByIskandar
Dim rr As New OleDb.OleDbCommand
Dim ee 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("Masukkan teks")
Exit Sub
End If
If t2_36109023.Text.Length = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If Val(t3_36109023.Text) = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If Val(t4_36109023.Text) = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If kb36109023.Text <> t1_36109023.Text Then
amelia.AturPencarianDataBase("Barang", "KodeBarang", t1_36109023.Text, 1, ee)
If amelia.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
rr = 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 & "'", ee)
ee.Open()
rr.ExecuteNonQuery()
ee.Close()
rr.Dispose()
kb36109023.Text = ""
t1_36109023.Text = ""
t2_36109023.Text = ""
t3_36109023.Text = ""
t4_36109023.Text = ""
Form30A_36109023.nn()
End Sub
End Class
0 komentar:
Posting Komentar