Public Class LATIHAN032A_46109040
Dim Hubung As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=46109040")
Dim Ukky As New DataTable
Private Sub Latihan32_A_46109040_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim adapter As New OleDb.OleDbDataAdapter
adapter = New OleDb.OleDbDataAdapter("select* from barang", Hubung)
adapter.Fill(Ukky)
VIEW_46109040.DataSource = Ukky
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_46109040.Click
If LATIHAN032C_46109040.Visible = False Then
LATIHAN032C_46109040.Show()
Else
LATIHAN032C_46109040.Activate()
End If
LATIHAN032C_46109040.ToolStripStatusLabel1.Text = "kode barang lama= " & VIEW_46109040.CurrentRow.Cells("kodebarang").Value
LATIHAN032C_46109040.KB_46109040.Text = VIEW_46109040.CurrentRow.Cells("kodebarang").Value
LATIHAN032C_46109040.NB_46109040.Text = VIEW_46109040.CurrentRow.Cells("namabarang").Value
LATIHAN032C_46109040.HJ_46109040.Text = VIEW_46109040.CurrentRow.Cells("hargajual").Value
LATIHAN032C_46109040.JB_46109040.Text = VIEW_46109040.CurrentRow.Cells("jumlahbarang").Value
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2_46109040.Click
If LATIHAN032B_46109040.Visible = False Then
LATIHAN032B_46109040.Show()
Else
LATIHAN032B_46109040.Activate()
End If
End Sub
End Class
Public Class LATIHAN032B_46109040
Dim Hubung As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=46109040")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_46109040.Click
If Val(KB_46109040.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If NB_46109040.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(HJ_46109040.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(JB_46109040.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
Dim Ukky As New OleDb.OleDbCommand
Ukky = New OleDb.OleDbCommand("psTambahBarang", Hubung)
Ukky.CommandType = CommandType.StoredProcedure
Ukky.Parameters.Add(New OleDb.OleDbParameter("pKodeBarang", KB_46109040.Text))
Ukky.Parameters.Add(New OleDb.OleDbParameter("pNamaBarang", NB_46109040.Text))
Ukky.Parameters.Add(New OleDb.OleDbParameter("pPersawal", Val(HJ_46109040.Text)))
Ukky.Parameters.Add(New OleDb.OleDbParameter("pHargajual", Val(JB_46109040.Text)))
Hubung.Open()
Ukky.ExecuteNonQuery()
Hubung.Close()
Ukky.Dispose()
KB_46109040.Text = ""
NB_46109040.Text = ""
HJ_46109040.Text = ""
JB_46109040.Text = ""
End Sub
Private Sub Latihan32_B_46109040_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class LATIHAN032C_46109040
Dim Hubung As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=46109040")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_46109040.Click
If Val(KB_46109040.Text) = 0 Then
MsgBox("Maaf kode barang belum diisi")
Exit Sub
End If
If NB_46109040.Text.Length = 0 Then
MsgBox("Maaf nama barang belum diisi")
Exit Sub
End If
If Val(HJ_46109040.Text) = 0 Then
MsgBox("Maaf harga jual belum diisi")
Exit Sub
End If
If Val(JB_46109040.Text) = 0 Then
MsgBox("Maaf jumlah barang belum diisi")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("UPDATE BARANG SET kodebarang = '" & KB_46109040.Text & "', namabarang = '" & NB_46109040.Text & "', hargajual = " & Val(HJ_46109040.Text) & ", jumlahbarang = " & Val(JB_46109040.Text) & " where kodebarang ='" & ToolStripStatusLabel1.Text & "'", Hubung)
Hubung.Open()
com.ExecuteNonQuery()
Hubung.Close()
com.Dispose()
KB_46109040.Text = ""
NB_46109040.Text = ""
HJ_46109040.Text = ""
JB_46109040.Text = ""
End Sub
Private Sub Latihan32_C_46109040_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Tidak ada komentar:
Posting Komentar