Public Class tugas32a46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Private Sub tugas32a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tm As New OleDb.OleDbDataAdapter
tm = New OleDb.OleDbDataAdapter("select* from barang", konek)
tm.Fill(itik)
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas32c46109033.Visible = False Then
tugas32c46109033.Show()
Else
tugas32c46109033.Activate()
End If
tugas32c46109033.ToolStripStatusLabel1.Text = "kode barang lama= " & DataGridView146109033.CurrentRow.Cells("kodebarang").Value
tugas32c46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("kodebarang").Value
tugas32c46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("namabarang").Value
tugas32c46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("hargajual").Value
tugas32c46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("jumlahbarang").Value
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109033.Click
If tugas32b46109033.Visible = False Then
tugas32b46109033.Show()
Else
tugas32b46109033.Activate()
End If
End Sub
End Class
Public Class tugas32b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If Val(t146109033.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("psTambahBarang", konek)
itik.CommandType = CommandType.StoredProcedure
itik.Parameters.Add(New OleDb.OleDbParameter("pKodeBarang", t146109033.Text))
itik.Parameters.Add(New OleDb.OleDbParameter("pNamaBarang", t246109033.Text))
itik.Parameters.Add(New OleDb.OleDbParameter("pPersawal", Val(t346109033.Text)))
itik.Parameters.Add(New OleDb.OleDbParameter("pHargajual", Val(t446109033.Text)))
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
Public Class tugas32c46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If Val(t146109033.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("UPDATE BARANG SET kodebarang = '" & t146109033.Text & "', namabarang = '" & t246109033.Text & "', hargajual = " & Val(t346109033.Text) & ", jumlahbarang = " & Val(t446109033.Text) & " where kodebarang ='" & ToolStripStatusLabel1.Text & "'", konek)
konek.Open()
com.ExecuteNonQuery()
konek.Close()
com.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
Tidak ada komentar:
Posting Komentar