Dim rossi As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet oledb:database password=46") Dim farah As New DataTable
Public Sub ambildata() Dim angkut As New OleDb.OleDbDataAdapter angkut = New OleDb.OleDbDataAdapter("select * from barang", rossi) farah.Rows.Clear() angkut.Fill(farah) angkut.Dispose()
End Sub
Private Sub LATIHAN030A_46109010_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ambildata() dtg46109010.DataSource = farah
End Sub
Private Sub edit46109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit46109010.Click If LATIHAN030B_46109010.Visible = False Then LATIHAN030B_46109010.Show() Else LATIHAN030B_46109010.Activate()
End If LATIHAN030B_46109010.kb46109010.Text = dtg46109010.CurrentRow.Cells("KODEBARANG").Value LATIHAN030B_46109010.t146109010.Text = dtg46109010.CurrentRow.Cells("KODEBARANG").Value LATIHAN030B_46109010.t246109010.Text = dtg46109010.CurrentRow.Cells("NAMABARANG").Value LATIHAN030B_46109010.t346109010.Text = dtg46109010.CurrentRow.Cells("HARGAJUAL").Value LATIHAN030B_46109010.t446109010.Text = dtg46109010.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub End Class
LATIHAN 30B
Public Class LATIHAN030B_46109010 Dim rossi As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet oledb:database password=46")
Private Sub simpan46109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan46109010.Click If t146109010.Text.Length = 0 Then MsgBox("Isi text yang kosong") Exit Sub End If
If t246109010.Text.Length = 0 Then MsgBox("Isi text yang kosong") Exit Sub End If
If Val(t346109010.Text) = 0 Then MsgBox("Isi text yang kosong") Exit Sub End If
If Val(t446109010.Text) = 0 Then MsgBox("Isi text yang kosong") Exit Sub End If
If kb46109010.Text <> t146109010.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("BARANG", "KODEBARANG", t146109010.Text, 1, rossi)
If pencari.JumlanBaris > 0 Then MsgBox("data yang anda masukkan telah ada, masukkan data baru")
Dim risky As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; Data Source=" & Application.StartupPath & "\DATABARANG.accdb;jet oledb:database password=kiki")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If QQ1_46109050.Text.Length = 0 Then MsgBox("Please Insert Your Text") Exit Sub End If
If QQ2_46109050.Text.Length = 0 Then MsgBox("Please Insert Your Text") Exit Sub End If
If Val(QQ3_46109050.Text) = 0 Then MsgBox("Please Insert Your Text") Exit Sub End If
If Val(QQ4_46109050.Text) = 0 Then MsgBox("Please Insert Your Text") Exit Sub End If
If KB_46109050.Text <> QQ1_46109050.Text Then Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", QQ1_46109050.Text, 1, risky)
If PENCARI.JumlanBaris > 0 Then MsgBox("The data has been exist please insert new data")
QQ1_46109050.Text = "" QQ2_46109050.Text = "" QQ3_46109050.Text = "" QQ4_46109050.Text = "" Exit Sub End If End If Dim mahira As New OleDb.OleDbCommand mahira = New OleDb.OleDbCommand("update BARANG set KODEBARANG = '" & QQ1_46109050.Text & "', NAMABARANG = '" & QQ2_46109050.Text & "', HARGAJUAL=" & Val(QQ3_46109050.Text) & ", JUMLAHBARANG=" & Val(QQ4_46109050.Text) & " where KODEBARANG='" & KB_46109050.Text & "'", risky) risky.Open() mahira.ExecuteNonQuery() risky.Close() mahira.Dispose()
Dim yusri As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb;jet OleDb:database password=300591")
Private Sub Latihan30B_46109038_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Simpan_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109038.Click
If Val(KobarBaru_46109038.Text) = 0 Then MsgBox("kode barang belum diisi") Exit Sub End If If NamBar_46109038.Text.Length = 0 Then MsgBox("nama barang belum terisi") Exit Sub End If
If Val(HarJu_46109038.Text) = 0 Then MsgBox("harga jual belum diisi") Exit Sub End If
If Val(JumBar_46109038.Text) = 0 Then MsgBox("jumlah barang belum diisi") Exit Sub End If
If KoBar_46109038.Text <> KobarBaru_46109038.Text Then Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KoBar_46109038.Text, 1, yusri)
If Pencari.JumlanBaris > 0 Then MsgBox("kode sudah ada") KoBar_46109038.Text = "" KobarBaru_46109038.Text = "" NamBar_46109038.Text = "" JumBar_46109038.Text = "" HarJu_46109038.Text = "" Exit Sub End If End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("update Barang set KODEBARANG='" & KobarBaru_46109038.Text & "',NAMABARANG='" & NamBar_46109038.Text & "',hargajual=" & Val(HarJu_46109038.Text) & ", JUMLAHBARANG=" & Val(JumBar_46109038.Text) & " where KODEBARANG='" & KoBar_46109038.Text & "'", yusri) yusri.Open() com.ExecuteNonQuery() yusri.Close() com.Dispose()
Dim saya As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:database password=015")
Private Sub Button1035_ClMsgBox("Plase Insert Your Text") Exit Sub End If
If Val(t3_46109015.Text) = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If Val(t4_46109015.Text) = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If kb46109015.Text <> t1_46109015.Text Then Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t1_46109015.Text, 1, saya)
If PENCARI.JumlanBaris > 0 Then MsgBox("The data has been exist please insert new data")
'mengosongkan text box t1_46109015.Text = " " t2_46109015.Text = " " t3_46109015.Text = " " t4_46109015.Text = " " Exit Sub End If End If
Dim Cm As New OleDb.OleDbCommand Cm = New OleDb.OleDbCommand("Update BARANG set KODEBARANG ='" & t1_46109015.Text & "', NAMABARANG = '" & t2_46109015.Text & "', HARGAJUAL=" & Val(t3_46109015.Text) & ", JUMLAHBARANG=" & Val(t4_46109015.Text) & " where KODEBARANG='" & kb46109015.Text & "'", saya) saya.Open() Cm.ExecuteNonQuery() saya.Close() Cm.Dispose()
Dim Way As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:database password=979264") Dim ambil As New DataTable
Public Sub ambildata()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM BARANG", Way) ambil.Rows.Clear() data.Fill(ambil) data.Dispose()
End Sub
Private Sub Latihan30A46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ambildata() DGV46109047.DataSource = ambil End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Latihan30B46109047.Visible = False Then Latihan30B46109047.Show() Else Latihan30B46109047.Activate() End If
Latihan30B46109047.kb46109047.Text = DGV46109047.CurrentRow.Cells("KODEBARANG").Value Latihan30B46109047.t146109047.Text = DGV46109047.CurrentRow.Cells("KODEBARANG").Value Latihan30B46109047.t246109047.Text = DGV46109047.CurrentRow.Cells("NAMABARANG").Value Latihan30B46109047.t346109047.Text = DGV46109047.CurrentRow.Cells("HARGAJUAL").Value Latihan30B46109047.t446109047.Text = DGV46109047.CurrentRow.Cells("JUMLAHBARANG").Value End Sub End Class
Dim Way As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:database password=979264")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If t146109047.Text.Length = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If t246109047.Text.Length = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If Val(t346109047.Text) = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If Val(t446109047.Text) = 0 Then MsgBox("Plase Insert Your Text") Exit Sub End If
If kb46109047.Text <> t146109047.Text Then Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109047.Text, 1, Way)
If PENCARI.JumlanBaris > 0 Then MsgBox("The data has been exist please insert new data")
t146109047.Text = " " t246109047.Text = " " t346109047.Text = " " t446109047.Text = " " Exit Sub End If End If
Dim Cm As New OleDb.OleDbCommand Cm = New OleDb.OleDbCommand("Update BARANG set KODEBARANG ='" & t146109047.Text & "', NAMABARANG = '" & t246109047.Text & "', HARGAJUAL=" & Val(t346109047.Text) & ", JUMLAHBARANG=" & Val(t446109047.Text) & " where KODEBARANG='" & kb46109047.Text & "'", Way) Way.Open() Cm.ExecuteNonQuery() Way.Close() Cm.Dispose()
Public Class LATIHAN30B46109026 Dim tinggal As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=26")
Private Sub LATIHAN30B46109026_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If kb46109026.Text.Length = 0 Then MsgBox("please insert your text") Exit Sub End If If nb46109026.Text.Length = 0 Then MsgBox("please insert your text") Exit Sub End If If Val(hj46109026.Text) = 0 Then MsgBox("please insert your text") Exit Sub End If If Val(jb46109026.Text) = 0 Then MsgBox("please insert your text") Exit Sub End If If kb146109026.Text <> kb46109026.Text Then Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109026.Text, 1, tinggal) If PENCARI.JumlanBaris > 0 Then MsgBox("the data has been exist please insert new data") kb46109026.Text = "" nb46109026.Text = "" hj46109026.Text = "" jb46109026.Text = "" Exit Sub End If End If
Dim Cm As New OleDb.OleDbCommand Cm = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & kb46109026.Text & "', NAMABARANG = '" & nb46109026.Text & "', HARGAJUAL=" & Val(hj46109026.Text) & ", JUMLAHBARANG=" & Val(jb46109026.Text) & " where KODEBARANG='" & kb146109026.Text & "'", tinggal) tinggal.Open() Cm.Dispose() kb146109026.Text = "" kb46109026.Text = "" nb46109026.Text = "" hj46109026.Text = "" jb46109026.Text = "" LATIHAN30A46109026.ambildata() Me.Close() End Sub End Class
Public Class Form30A Dim conect As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=allah swt") Dim vero As New DataTable Private Sub Form15_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nika As New OleDb.OleDbDataAdapter nika = New OleDb.OleDbDataAdapter("select * from barang", conect) nika.Fill(vero) DGV1_052.DataSource = vero End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Form30B.Visible = False Then Form30B.Show() Else Form30B.Activate() End If End Sub End Class
Public Class Form30B Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=allah swt") Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Val(vd1_052.Text) = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If If vd2_052.Text.Length = 0 Then MsgBox("nama barang belum terisi") Exit Sub End If If Val(vd3_052.Text) = 0 Then MsgBox("harga jual belum diisi") Exit Sub End If If Val(vd4_052.Text) = 0 Then MsgBox("jumlah barang belum diisi") Exit Sub End If cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb.Text, 1, conect) If cari.JumlanBaris = False Then MsgBox("kode tidak ada") Exit Sub End If Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("UPDATE BARANG SET kodebarang = '" & vd1_052.Text & "', namabarang = '" & vd2_052.Text & "', hargajual = " & Val(vd3_052.Text) & ", jumlahbarang = " & Val(vd4_052.Text) & " where kodebarang ='" & kb.Text & "'", conect) conect.Open() com.ExecuteNonQuery() conect.Close() com.Dispose() kb.Text = "" vd1_052.Text = "" vd2_052.Text = "" vd3_052.Text = "" vd4_052.Text = "" End Sub End Class
maaf pak saya buat blog baru . di blog yang baru itu saya posting dari form 30-60, sedangkan yang blog lama saya posting 1-29 ( tapi blog lama sudah expired)
Public Class latihan_30A_46109044 Dim dt As New DataTable Dim connect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub syahril() Dim fm As New OleDb.OleDbDataAdapter fm = New OleDb.OleDbDataAdapter("select * from barang", connect) dt.Rows.Clear() fm.Fill(dt) fm.Dispose() End Sub
Private Sub Latihan_30A_46109044_022_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load syahril() dgv46109044.DataSource = dt End Sub
Private Sub E46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles E46109044.Click If latihan_30B_46109044.Visible = False Then latihan_30B_46109044.Show() Else latihan_30B_46109044.Activate() End If
Public Class Latihan_30B_46109044 Dim syahril As New ByIskandar.CariKeDataBaseByIskandar Dim cm As New OleDb.OleDbCommand Dim connect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub ff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ff.Click If bb.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If cc.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(dd.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(ee.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If aa.Text <> bb.Text Then syahril.AturPencarianDataBase("Barang", "KodeBarang", bb.Text, 1, connect) If syahril.JumlanBaris > 0 Then MsgBox("Adami kode barang seperti itu") Exit Sub End If End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & bb.Text & "', namabarang = '" & cc.Text & "', hargajual = " & Val(dd.Text) & ", jumlahbarang = " & Val(ee.Text) & " where kodebarang = '" & aa.Text & "'", connect)
FARADILLAH AMALIA RIVAI
BalasHapusLATIHAN 30 A
Public Class LATIHAN030A_46109010
Dim rossi As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet oledb:database password=46")
Dim farah As New DataTable
Public Sub ambildata()
Dim angkut As New OleDb.OleDbDataAdapter
angkut = New OleDb.OleDbDataAdapter("select * from barang", rossi)
farah.Rows.Clear()
angkut.Fill(farah)
angkut.Dispose()
End Sub
Private Sub LATIHAN030A_46109010_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
dtg46109010.DataSource = farah
End Sub
Private Sub edit46109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit46109010.Click
If LATIHAN030B_46109010.Visible = False Then
LATIHAN030B_46109010.Show()
Else
LATIHAN030B_46109010.Activate()
End If
LATIHAN030B_46109010.kb46109010.Text = dtg46109010.CurrentRow.Cells("KODEBARANG").Value
LATIHAN030B_46109010.t146109010.Text = dtg46109010.CurrentRow.Cells("KODEBARANG").Value
LATIHAN030B_46109010.t246109010.Text = dtg46109010.CurrentRow.Cells("NAMABARANG").Value
LATIHAN030B_46109010.t346109010.Text = dtg46109010.CurrentRow.Cells("HARGAJUAL").Value
LATIHAN030B_46109010.t446109010.Text = dtg46109010.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
End Class
LATIHAN 30B
Public Class LATIHAN030B_46109010
Dim rossi As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet oledb:database password=46")
Private Sub simpan46109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan46109010.Click
If t146109010.Text.Length = 0 Then
MsgBox("Isi text yang kosong")
Exit Sub
End If
If t246109010.Text.Length = 0 Then
MsgBox("Isi text yang kosong")
Exit Sub
End If
If Val(t346109010.Text) = 0 Then
MsgBox("Isi text yang kosong")
Exit Sub
End If
If Val(t446109010.Text) = 0 Then
MsgBox("Isi text yang kosong")
Exit Sub
End If
If kb46109010.Text <> t146109010.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("BARANG", "KODEBARANG", t146109010.Text, 1, rossi)
If pencari.JumlanBaris > 0 Then
MsgBox("data yang anda masukkan telah ada, masukkan data baru")
t146109010.Text = ""
t246109010.Text = ""
t346109010.Text = ""
t446109010.Text = ""
Exit Sub
End If
End If
Dim vr As New OleDb.OleDbCommand
vr = New OleDb.OleDbCommand("update barang set kodebarang = '" & t146109010.Text & "', namabarang = '" & t246109010.Text & "', hargajual = " & Val(t346109010.Text) & ", jumlahbarang = " & Val(t446109010.Text) & " where kodebarang = '" & kb46109010.Text & "'", rossi)
rossi.Open()
vr.ExecuteNonQuery()
rossi.Close()
rossi.Dispose()
kb46109010.Text = ""
t146109010.Text = ""
t246109010.Text = ""
t346109010.Text = ""
t446109010.Text = ""
LATIHAN030A_46109010.ambildata()
Me.Close()
End Sub
End Class
Public Class Latihan30B_46109050
BalasHapusDim risky As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; Data Source=" & Application.StartupPath & "\DATABARANG.accdb;jet oledb:database password=kiki")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If QQ1_46109050.Text.Length = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If QQ2_46109050.Text.Length = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If Val(QQ3_46109050.Text) = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If Val(QQ4_46109050.Text) = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If KB_46109050.Text <> QQ1_46109050.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", QQ1_46109050.Text, 1, risky)
If PENCARI.JumlanBaris > 0 Then
MsgBox("The data has been exist please insert new data")
QQ1_46109050.Text = ""
QQ2_46109050.Text = ""
QQ3_46109050.Text = ""
QQ4_46109050.Text = ""
Exit Sub
End If
End If
Dim mahira As New OleDb.OleDbCommand
mahira = New OleDb.OleDbCommand("update BARANG set KODEBARANG = '" & QQ1_46109050.Text & "', NAMABARANG = '" & QQ2_46109050.Text & "', HARGAJUAL=" & Val(QQ3_46109050.Text) & ", JUMLAHBARANG=" & Val(QQ4_46109050.Text) & " where KODEBARANG='" & KB_46109050.Text & "'", risky)
risky.Open()
mahira.ExecuteNonQuery()
risky.Close()
mahira.Dispose()
KB_46109050.Text = ""
QQ1_46109050.Text = ""
QQ2_46109050.Text = ""
QQ3_46109050.Text = ""
QQ4_46109050.Text = ""
Latihan30A_46109050.ambildata()
Me.Close()
End Sub
End Class
Andi Muh. Yusri
BalasHapus46109038
Public Class Latihan30B_46109038
Dim yusri As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb;jet OleDb:database password=300591")
Private Sub Latihan30B_46109038_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Simpan_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109038.Click
If Val(KobarBaru_46109038.Text) = 0 Then
MsgBox("kode barang belum diisi")
Exit Sub
End If
If NamBar_46109038.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(HarJu_46109038.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(JumBar_46109038.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
If KoBar_46109038.Text <> KobarBaru_46109038.Text Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KoBar_46109038.Text, 1, yusri)
If Pencari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
KoBar_46109038.Text = ""
KobarBaru_46109038.Text = ""
NamBar_46109038.Text = ""
JumBar_46109038.Text = ""
HarJu_46109038.Text = ""
Exit Sub
End If
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("update Barang set KODEBARANG='" & KobarBaru_46109038.Text & "',NAMABARANG='" & NamBar_46109038.Text & "',hargajual=" & Val(HarJu_46109038.Text) & ", JUMLAHBARANG=" & Val(JumBar_46109038.Text) & " where KODEBARANG='" & KoBar_46109038.Text & "'", yusri)
yusri.Open()
com.ExecuteNonQuery()
yusri.Close()
com.Dispose()
KoBar_46109038.Text = ""
KobarBaru_46109038.Text = ""
NamBar_46109038.Text = ""
JumBar_46109038.Text = ""
HarJu_46109038.Text = ""
Latihan30A_46109038.ambildata()
Me.Close()
End Sub
End Class
Public Class Latihan030B_46109015
BalasHapusDim saya As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:database password=015")
Private Sub Button1035_ClMsgBox("Plase Insert Your Text")
Exit Sub
End If
If Val(t3_46109015.Text) = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If Val(t4_46109015.Text) = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If kb46109015.Text <> t1_46109015.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t1_46109015.Text, 1, saya)
If PENCARI.JumlanBaris > 0 Then
MsgBox("The data has been exist please insert new data")
'mengosongkan text box
t1_46109015.Text = " "
t2_46109015.Text = " "
t3_46109015.Text = " "
t4_46109015.Text = " "
Exit Sub
End If
End If
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("Update BARANG set KODEBARANG ='" & t1_46109015.Text & "', NAMABARANG = '" & t2_46109015.Text & "', HARGAJUAL=" & Val(t3_46109015.Text) & ", JUMLAHBARANG=" & Val(t4_46109015.Text) & " where KODEBARANG='" & kb46109015.Text & "'", saya)
saya.Open()
Cm.ExecuteNonQuery()
saya.Close()
Cm.Dispose()
kb46109015.Text = " "
t1_46109015.Text = " "
t2_46109015.Text = " "
t3_46109015.Text = " "
t4_46109015.Text = " "
Latihan030A_46109015.ambildata()
Me.Close()
End Sub
End Class
Public Class Latihan30A46109047
BalasHapusDim Way As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:database password=979264")
Dim ambil As New DataTable
Public Sub ambildata()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM BARANG", Way)
ambil.Rows.Clear()
data.Fill(ambil)
data.Dispose()
End Sub
Private Sub Latihan30A46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
DGV46109047.DataSource = ambil
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Latihan30B46109047.Visible = False Then
Latihan30B46109047.Show()
Else
Latihan30B46109047.Activate()
End If
Latihan30B46109047.kb46109047.Text = DGV46109047.CurrentRow.Cells("KODEBARANG").Value
Latihan30B46109047.t146109047.Text = DGV46109047.CurrentRow.Cells("KODEBARANG").Value
Latihan30B46109047.t246109047.Text = DGV46109047.CurrentRow.Cells("NAMABARANG").Value
Latihan30B46109047.t346109047.Text = DGV46109047.CurrentRow.Cells("HARGAJUAL").Value
Latihan30B46109047.t446109047.Text = DGV46109047.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
End Class
Public Class Latihan30B46109047
BalasHapusDim Way As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:database password=979264")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If t146109047.Text.Length = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If t246109047.Text.Length = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If Val(t346109047.Text) = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If Val(t446109047.Text) = 0 Then
MsgBox("Plase Insert Your Text")
Exit Sub
End If
If kb46109047.Text <> t146109047.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109047.Text, 1, Way)
If PENCARI.JumlanBaris > 0 Then
MsgBox("The data has been exist please insert new data")
t146109047.Text = " "
t246109047.Text = " "
t346109047.Text = " "
t446109047.Text = " "
Exit Sub
End If
End If
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("Update BARANG set KODEBARANG ='" & t146109047.Text & "', NAMABARANG = '" & t246109047.Text & "', HARGAJUAL=" & Val(t346109047.Text) & ", JUMLAHBARANG=" & Val(t446109047.Text) & " where KODEBARANG='" & kb46109047.Text & "'", Way)
Way.Open()
Cm.ExecuteNonQuery()
Way.Close()
Cm.Dispose()
kb46109047.Text = " "
t146109047.Text = " "
t246109047.Text = " "
t346109047.Text = " "
t446109047.Text = " "
Latihan30A46109047.ambildata()
Me.Close()
End Sub
End Class
Public Class LATIHAN30B46109026
BalasHapusDim tinggal As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=26")
Private Sub LATIHAN30B46109026_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb46109026.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If nb46109026.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(hj46109026.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(jb46109026.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If kb146109026.Text <> kb46109026.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109026.Text, 1, tinggal)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
kb46109026.Text = ""
nb46109026.Text = ""
hj46109026.Text = ""
jb46109026.Text = ""
Exit Sub
End If
End If
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & kb46109026.Text & "', NAMABARANG = '" & nb46109026.Text & "', HARGAJUAL=" & Val(hj46109026.Text) & ", JUMLAHBARANG=" & Val(jb46109026.Text) & " where KODEBARANG='" & kb146109026.Text & "'", tinggal)
tinggal.Open()
Cm.Dispose()
kb146109026.Text = ""
kb46109026.Text = ""
nb46109026.Text = ""
hj46109026.Text = ""
jb46109026.Text = ""
LATIHAN30A46109026.ambildata()
Me.Close()
End Sub
End Class
Public Class Form30A
BalasHapusDim conect As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=allah swt")
Dim vero As New DataTable
Private Sub Form15_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim nika As New OleDb.OleDbDataAdapter
nika = New OleDb.OleDbDataAdapter("select * from barang", conect)
nika.Fill(vero)
DGV1_052.DataSource = vero
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Form30B.Visible = False Then
Form30B.Show()
Else
Form30B.Activate()
End If
End Sub
End Class
Public Class Form30B
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=allah swt")
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Val(vd1_052.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If vd2_052.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(vd3_052.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(vd4_052.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb.Text, 1, conect)
If cari.JumlanBaris = False Then
MsgBox("kode tidak ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("UPDATE BARANG SET kodebarang = '" & vd1_052.Text & "', namabarang = '" & vd2_052.Text & "', hargajual = " & Val(vd3_052.Text) & ", jumlahbarang = " & Val(vd4_052.Text) & " where kodebarang ='" & kb.Text & "'", conect)
conect.Open()
com.ExecuteNonQuery()
conect.Close()
com.Dispose()
kb.Text = ""
vd1_052.Text = ""
vd2_052.Text = ""
vd3_052.Text = ""
vd4_052.Text = ""
End Sub
End Class
http://kumpulanlatihan46109060.blogspot.com/2011/11/latihan-30.html
BalasHapushttp://taufiqgooners.blogspot.com/2011/11/latihan-30-apkom.html
BalasHapushttp://irvanbravely.blogspot.com/2011/11/latihan-30-apkom.html
BalasHapusmaaf pak saya buat blog baru . di blog yang baru itu saya posting dari form 30-60, sedangkan yang blog lama saya posting 1-29 ( tapi blog lama sudah expired)
BalasHapusPublic Class latihan_30A_46109044
BalasHapusDim dt As New DataTable
Dim connect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub syahril()
Dim fm As New OleDb.OleDbDataAdapter
fm = New OleDb.OleDbDataAdapter("select * from barang", connect)
dt.Rows.Clear()
fm.Fill(dt)
fm.Dispose()
End Sub
Private Sub Latihan_30A_46109044_022_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
syahril()
dgv46109044.DataSource = dt
End Sub
Private Sub E46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles E46109044.Click
If latihan_30B_46109044.Visible = False Then
latihan_30B_46109044.Show()
Else
latihan_30B_46109044.Activate()
End If
latihan_30B_46109044.aa.Text = dgv46109044.CurrentRow.Cells("kodebarang").Value
latihan_30B_46109044.bb.Text = dgv46109044.CurrentRow.Cells("kodebarang").Value
latihan_30B_46109044.cc.Text = dgv46109044.CurrentRow.Cells("namabarang").Value
latihan_30B_46109044.dd.Text = dgv46109044.CurrentRow.Cells("hargajual").Value
latihan_30B_46109044.ee.Text = dgv46109044.CurrentRow.Cells("jumlahbarang").Value
latihan_30B_46109044.Show()
End Sub
End Class
Public Class Latihan_30B_46109044
BalasHapusDim syahril As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim connect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub ff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ff.Click
If bb.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If cc.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(dd.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(ee.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If aa.Text <> bb.Text Then
syahril.AturPencarianDataBase("Barang", "KodeBarang", bb.Text, 1, connect)
If syahril.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & bb.Text & "', namabarang = '" & cc.Text & "', hargajual = " & Val(dd.Text) & ", jumlahbarang = " & Val(ee.Text) & " where kodebarang = '" & aa.Text & "'", connect)
connect.Open()
cm.ExecuteNonQuery()
connect.Close()
cm.Dispose()
aa.Text = ""
bb.Text = ""
cc.Text = ""
dd.Text = ""
ee.Text = ""
latihan_30A_46109044.syahril()
End Sub
End Class