Public Class LATIHAN030A_46109040
Dim jembatan As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=46109040")
Dim ambil As New DataTable
Public Sub ambildata()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM BARANG", jembatan)
ambil.Rows.Clear()
data.Fill(ambil)
data.Dispose()
End Sub
Private Sub Form30_A_46109040_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
VIEW_46109040.DataSource = ambil
End Sub
Private Sub Button1_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_46109040.Click
If LATIHAN030B_46109040.Visible = False Then
LATIHAN030B_46109040.Show()
Else
LATIHAN030B_46109040.Activate()
End If
LATIHAN030B_46109040.KB_46109040.Text = VIEW_46109040.CurrentRow.Cells("KODEBARANG").Value
LATIHAN030B_46109040.KB1_46109040.Text = VIEW_46109040.CurrentRow.Cells("KODEBARANG").Value
LATIHAN030B_46109040.NB_46109040.Text = VIEW_46109040.CurrentRow.Cells("NAMABARANG").Value
LATIHAN030B_46109040.HJ_46109040.Text = VIEW_46109040.CurrentRow.Cells("HARGAJUAL").Value
LATIHAN030B_46109040.JB_46109040.Text = VIEW_46109040.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
End Class
Public Class LATIHAN030B_46109040
Dim Jembatan 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 KODE_46109040.Text.Length = 0 Then
MsgBox("Tolong isi text Anda")
Exit Sub
End If
If NB_46109040.Text.Length = 0 Then
MsgBox("Tolong isi text Anda")
Exit Sub
End If
If Val(HJ_46109040.Text) = 0 Then
MsgBox("Tolong isi text Anda")
Exit Sub
End If
If Val(JB_46109040.Text) = 0 Then
MsgBox("Tolong isi text Anda")
Exit Sub
End If
If KB_46109040.Text <> KODE_46109040.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", KODE_46109040.Text, 1, Jembatan)
If PENCARI.JumlanBaris > 0 Then
MsgBox("Data tersebut sudah ada,tolong masukkan data baru")
KODE_46109040.Text = ""
NB_46109040.Text = ""
HJ_46109040.Text = ""
JB_46109040.Text = ""
Exit Sub
End If
End If
Dim Perintah As New OleDb.OleDbCommand
Perintah = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & KODE_46109040.Text & "', NAMABARANG = '" & NB_46109040.Text & "', HARGAJUAL=" & Val(HJ_46109040.Text) & ", JUMLAHBARANG=" & Val(JB_46109040.Text) & " where KODEBARANG='" & KB_46109040.Text & "'", Jembatan)
Jembatan.Open()
Perintah.Dispose()
KB_46109040.Text = ""
KODE_46109040.Text = ""
NB_46109040.Text = ""
HJ_46109040.Text = ""
JB_46109040.Text = ""
LATIHAN030A_46109040.ambildata()
Me.Close()
End Sub
End Class
Tidak ada komentar:
Posting Komentar