Dim jalankan 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 faradillah As New OleDb.OleDbDataAdapter
faradillah = New OleDb.OleDbDataAdapter("SELECT* from BARANG", jalankan)
farah.Rows.Clear()
faradillah.Fill(farah) faradillah.Dispose() End Sub
Private Sub Latihan28a46109010_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ambildata() dtg46109010.DataSource = farah End Sub
Private Sub input46109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles input46109010.Click
If LATIHAN028B_46109010.Visible = False Then
LATIHAN028B_46109010.Show()
Else LATIHAN028B_46109010.Activate()
End If End Sub
Private Sub tutup46109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tutup46109010.Click Me.Close() End Sub
Dim jalankan 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 kb46109010.Text.Length = 0 Then MsgBox("masukkan data") Exit Sub End If
If t246109010.Text.Length = 0 Then MsgBox("masukkan data") Exit Sub End If
If Val(t346109010.Text) = 0 Then MsgBox("masukkan data") Exit Sub End If
If Val(t446109010.Text) = 0 Then MsgBox("masukkan data") Exit Sub End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109010.Text, 1, jalankan)
If PENCARI.JumlanBaris > 0 Then MsgBox("data yang anda masukkan sudah ada, masukkan data baru")
kb46109010.Text = " " t246109010.Text = " " t346109010.Text = " " t446109010.Text = " " Exit Sub End If
Dim vr As New OleDb.OleDbCommand vr = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb46109010.Text & "','" & t246109010.Text & "', " & Val(t346109010.Text) & "," & Val(t446109010.Text) & ")", jalankan)
Dim risky As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; Data Source=" & Application.StartupPath & "\DATABARANG.accdb;jet oledb:database password=kiki") Dim mahira As New DataTable
Public Sub ambildata() Dim data As New OleDb.OleDbDataAdapter data = New OleDb.OleDbDataAdapter("SELECT*From BARANG", risky) mahira.Rows.Clear() data.Fill(mahira) data.Dispose() End Sub
Private Sub Latihan28A_46109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ambildata() DGV1_46109050.DataSource = mahira End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Latihan28B_46109050.Visible = False Then Latihan28B_46109050.Show() Else Latihan28B_46109050.Activate() End If End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub End Class
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("Isi kolom yang kosong") Exit Sub End If
If QQ2_46109050.Text.Length = 0 Then MsgBox("Isi kolom yang kosong") Exit Sub End If
If Val(QQ3_46109050.Text) = 0 Then MsgBox("Isi kolom yang kosong") Exit Sub End If
If Val(QQ4_46109050.Text) = 0 Then MsgBox("Isi kolom yang kosong") Exit Sub End If
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
Dim cm As New OleDb.OleDbCommand cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & QQ1_46109050.Text & "','" & QQ2_46109050.Text & "', " & Val(QQ3_46109050.Text) & "," & Val(QQ4_46109050.Text) & ")", risky) risky.Open() cm.ExecuteNonQuery() risky.Close() cm.Dispose()
Public Class Latihan28B_46109038 Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb;jet OleDb:database password=300591")
Private Sub Simpan_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109038.Click If Val(KoBar_46109038.Text) = 0 Then MsgBox("kode barang belum terisi") 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
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KoBar_46109038.Text, 1, conect)
If Pencari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & KoBar_46109038.Text & "','" & NamBar_46109038.Text & "'," & Val(HarJu_46109038.Text) & "," & Val(JumBar_46109038.Text) & ")", conect) conect.Open() com.ExecuteNonQuery() conect.Close() com.Dispose()
Dim Itha 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 TB146109047.Text.Length = 0 Then MsgBox("Isi kolom yang kosong") Exit Sub End If
If TB246109047.Text.Length = 0 Then MsgBox("Isi kolom yang kosong") Exit Sub End If
If Val(TB346109047.Text) = 0 Then MsgBox("Isi kolom yang kosong") Exit Sub End If
If Val(TB446109047.Text) = 0 Then MsgBox("Isi kolom yang kosong") Exit Sub End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", TB146109047.Text, 1, Itha) If PENCARI.JumlanBaris > 0 Then MsgBox("The data has been exist please insert new data") TB146109047.Text = "" TB246109047.Text = "" TB346109047.Text = "" TB446109047.Text = "" Exit Sub End If
Dim cm As New OleDb.OleDbCommand cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & TB146109047.Text & "','" & TB246109047.Text & "', " & Val(TB346109047.Text) & "," & Val(TB446109047.Text) & ")", Itha) Itha.Open() cm.ExecuteNonQuery() Itha.Close() cm.Dispose()
ublic Class LATIHAN28A46109026 Dim go As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:database password=parandangi") Dim ambil As New DataTable
Public Sub ambildata() Dim data As New OleDb.OleDbDataAdapter data = New OleDb.OleDbDataAdapter("select*from barang", go) ambil.Rows.Clear() data.Fill(ambil) data.Dispose()
End Sub
Private Sub LATIHAN28A46109026_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ambildata() dtg46109026.DataSource = ambil End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If LATIHAN28B46109026.Visible = False Then LATIHAN28B46109026.Show() Else LATIHAN28B46109026.Activate()
End If End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.Close() End Sub End Class
Public Class LATIHAN28B46109026 Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =D:\materi kuliah II\semester 5\VB\LATIHAN 27-34 SIMPAN EDIT DELETE DATA\DATABARANG.accdb")
Private Sub LATIHAN28B46109026_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 Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109026.Text, 1, go) 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 Dim Cm As New OleDb.OleDbCommand Cm = New OleDb.OleDbCommand("INSERT INTO BARANG(KODEBARANG,NAMABARANG,HARGAJUAL,JUMLAHBARANG)VALUES ('" & kb46109026.Text & "','" & nb46109026.Text & "'," & Val(hj46109026.Text) & "," & Val(jb46109026.Text) & " )", go) go.Open() Cm.ExecuteNonQuery() go.Close() Cm.Dispose() kb46109026.Text = "" nb46109026.Text = "" hj46109026.Text = "" jb46109026.Text = "" LATIHAN28A46109026.ambildata() Me.Close() End Sub
Public Class latihan_28A_46109044 Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet oledb:database password=1234") Dim take As New DataTable Public Sub ambildata()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* from BARANG", conect) take.Rows.Clear() data.Fill(take) data.Dispose() End Sub
Private Sub latihan028A_46109002_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ambildata() data46109044.DataSource = take End Sub
Private Sub I46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles I46109044.Click If latihan_28B_46109044.Visible = False Then latihan_28B_46109044.Show() Else latihan_28B_46109044.Activate() End If End Sub
Private Sub T46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T46109044.Click Me.Close() End Sub End Class
FARADILLAH AMALIA RIVAI
BalasHapusLATIHAN 28 A
Public Class LATIHAN28A_46109010
Dim jalankan 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 faradillah As New OleDb.OleDbDataAdapter
faradillah = New OleDb.OleDbDataAdapter("SELECT* from BARANG", jalankan)
farah.Rows.Clear()
faradillah.Fill(farah)
faradillah.Dispose()
End Sub
Private Sub Latihan28a46109010_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
dtg46109010.DataSource = farah
End Sub
Private Sub input46109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles input46109010.Click
If LATIHAN028B_46109010.Visible = False Then
LATIHAN028B_46109010.Show()
Else
LATIHAN028B_46109010.Activate()
End If
End Sub
Private Sub tutup46109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tutup46109010.Click
Me.Close()
End Sub
End Class
FARADILLAH AMALIA RIVAI
BalasHapusLATIHAN 28 B
Public Class LATIHAN028B_46109010
Dim jalankan 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 kb46109010.Text.Length = 0 Then
MsgBox("masukkan data")
Exit Sub
End If
If t246109010.Text.Length = 0 Then
MsgBox("masukkan data")
Exit Sub
End If
If Val(t346109010.Text) = 0 Then
MsgBox("masukkan data")
Exit Sub
End If
If Val(t446109010.Text) = 0 Then
MsgBox("masukkan data")
Exit Sub
End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109010.Text, 1, jalankan)
If PENCARI.JumlanBaris > 0 Then
MsgBox("data yang anda masukkan sudah ada, masukkan data baru")
kb46109010.Text = " "
t246109010.Text = " "
t346109010.Text = " "
t446109010.Text = " "
Exit Sub
End If
Dim vr As New OleDb.OleDbCommand
vr = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb46109010.Text & "','" & t246109010.Text & "', " & Val(t346109010.Text) & "," & Val(t446109010.Text) & ")", jalankan)
jalankan.Open()
vr.ExecuteNonQuery()
jalankan.Close()
vr.Dispose()
kb46109010.Text = " "
t246109010.Text = " "
t346109010.Text = " "
t446109010.Text = " "
LATIHAN28A_46109010.ambildata()
Me.Close()
End Sub
End Class
Public Class Latihan28A_46109050
BalasHapusDim risky As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; Data Source=" & Application.StartupPath & "\DATABARANG.accdb;jet oledb:database password=kiki")
Dim mahira As New DataTable
Public Sub ambildata()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT*From BARANG", risky)
mahira.Rows.Clear()
data.Fill(mahira)
data.Dispose()
End Sub
Private Sub Latihan28A_46109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
DGV1_46109050.DataSource = mahira
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Latihan28B_46109050.Visible = False Then
Latihan28B_46109050.Show()
Else
Latihan28B_46109050.Activate()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class
Public Class Latihan28B_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("Isi kolom yang kosong")
Exit Sub
End If
If QQ2_46109050.Text.Length = 0 Then
MsgBox("Isi kolom yang kosong")
Exit Sub
End If
If Val(QQ3_46109050.Text) = 0 Then
MsgBox("Isi kolom yang kosong")
Exit Sub
End If
If Val(QQ4_46109050.Text) = 0 Then
MsgBox("Isi kolom yang kosong")
Exit Sub
End If
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
Dim cm As New OleDb.OleDbCommand
cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & QQ1_46109050.Text & "','" & QQ2_46109050.Text & "', " & Val(QQ3_46109050.Text) & "," & Val(QQ4_46109050.Text) & ")", risky)
risky.Open()
cm.ExecuteNonQuery()
risky.Close()
cm.Dispose()
QQ1_46109050.Text = ""
QQ2_46109050.Text = ""
QQ3_46109050.Text = ""
QQ4_46109050.Text = ""
Latihan28A_46109050.ambildata()
Me.Close()
End Sub
End Class
Andi Muh. Yusri
BalasHapus46109038
Public Class Latihan28B_46109038
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb;jet OleDb:database password=300591")
Private Sub Simpan_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109038.Click
If Val(KoBar_46109038.Text) = 0 Then
MsgBox("kode barang belum terisi")
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
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KoBar_46109038.Text, 1, conect)
If Pencari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & KoBar_46109038.Text & "','" & NamBar_46109038.Text & "'," & Val(HarJu_46109038.Text) & "," & Val(JumBar_46109038.Text) & ")", conect)
conect.Open()
com.ExecuteNonQuery()
conect.Close()
com.Dispose()
KoBar_46109038.Text = ""
NamBar_46109038.Text = ""
JumBar_46109038.Text = ""
HarJu_46109038.Text = ""
Latihan28A_46109038.ambildata()
Me.Close()
End Sub
Private Sub Latihan28B_46109038_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class Latihan28B46109047
BalasHapusDim Itha 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 TB146109047.Text.Length = 0 Then
MsgBox("Isi kolom yang kosong")
Exit Sub
End If
If TB246109047.Text.Length = 0 Then
MsgBox("Isi kolom yang kosong")
Exit Sub
End If
If Val(TB346109047.Text) = 0 Then
MsgBox("Isi kolom yang kosong")
Exit Sub
End If
If Val(TB446109047.Text) = 0 Then
MsgBox("Isi kolom yang kosong")
Exit Sub
End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", TB146109047.Text, 1, Itha)
If PENCARI.JumlanBaris > 0 Then
MsgBox("The data has been exist please insert new data")
TB146109047.Text = ""
TB246109047.Text = ""
TB346109047.Text = ""
TB446109047.Text = ""
Exit Sub
End If
Dim cm As New OleDb.OleDbCommand
cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & TB146109047.Text & "','" & TB246109047.Text & "', " & Val(TB346109047.Text) & "," & Val(TB446109047.Text) & ")", Itha)
Itha.Open()
cm.ExecuteNonQuery()
Itha.Close()
cm.Dispose()
TB146109047.Text = ""
TB246109047.Text = ""
TB346109047.Text = ""
TB446109047.Text = ""
Latihan28A46109047.ambildata()
Me.Close()
End Sub
End Class
ublic Class LATIHAN28A46109026
BalasHapusDim go As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:database password=parandangi")
Dim ambil As New DataTable
Public Sub ambildata()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("select*from barang", go)
ambil.Rows.Clear()
data.Fill(ambil)
data.Dispose()
End Sub
Private Sub LATIHAN28A46109026_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
dtg46109026.DataSource = ambil
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If LATIHAN28B46109026.Visible = False Then
LATIHAN28B46109026.Show()
Else
LATIHAN28B46109026.Activate()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class
Public Class LATIHAN28B46109026
BalasHapusDim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =D:\materi kuliah II\semester 5\VB\LATIHAN 27-34 SIMPAN EDIT DELETE DATA\DATABARANG.accdb")
Private Sub LATIHAN28B46109026_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
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109026.Text, 1, go)
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
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("INSERT INTO BARANG(KODEBARANG,NAMABARANG,HARGAJUAL,JUMLAHBARANG)VALUES ('" & kb46109026.Text & "','" & nb46109026.Text & "'," & Val(hj46109026.Text) & "," & Val(jb46109026.Text) & " )", go)
go.Open()
Cm.ExecuteNonQuery()
go.Close()
Cm.Dispose()
kb46109026.Text = ""
nb46109026.Text = ""
hj46109026.Text = ""
jb46109026.Text = ""
LATIHAN28A46109026.ambildata()
Me.Close()
End Sub
End Class
http://kumpulanlatihan46109060.blogspot.com/2011/11/latihan-28.html
BalasHapushttp://taufiqgooners.blogspot.com/2011/11/latihan-28-apkom.html
BalasHapushttp://irvanbravely.blogspot.com/2011/11/latihan-28-apkom.html
BalasHapusPublic Class latihan_28A_46109044
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet oledb:database password=1234")
Dim take As New DataTable
Public Sub ambildata()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* from BARANG", conect)
take.Rows.Clear()
data.Fill(take)
data.Dispose()
End Sub
Private Sub latihan028A_46109002_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
data46109044.DataSource = take
End Sub
Private Sub I46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles I46109044.Click
If latihan_28B_46109044.Visible = False Then
latihan_28B_46109044.Show()
Else
latihan_28B_46109044.Activate()
End If
End Sub
Private Sub T46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T46109044.Click
Me.Close()
End Sub
End Class