Public Class tugas30a46109033
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
Public Sub ambil()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM BARANG", konek)
itik.Rows.Clear()
data.Fill(itik)
data.Dispose()
End Sub
Private Sub tugas30a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button146109033_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas30b46109033.Visible = False Then
tugas30b46109033.Show()
Else
tugas30b46109033.Activate()
End If
tugas30b46109033.kb46109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas30b46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas30b46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("NAMABARANG").Value
tugas30b46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("HARGAJUAL").Value
tugas30b46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
End Class
Public Class tugas30b46109033
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 t146109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If kb46109033.Text <> t146109033.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & t146109033.Text & "', NAMABARANG = '" & t246109033.Text & "', HARGAJUAL=" & Val(t346109033.Text) & ", JUMLAHBARANG=" & Val(t446109033.Text) & " where KODEBARANG='" & kb46109033.Text & "'", konek)
konek.Open()
itik.Dispose()
kb46109033.Text = ""
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
tugas30a46109033.ambil()
Me.Close()
End Sub
End Class
Tidak ada komentar:
Posting Komentar