Dim arman As New ByIskandar.CariKeDataBaseByIskandar Dim anto As New OleDb.OleDbCommand Dim ndut As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub simpan_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109003.Click arman.AturPencarianDataBase("Barang", "KodeBarang", kb_36109003.Text, 1, ndut) If arman.JumlanBaris > 0 Then MsgBox("kode barang telah ada") kb_36109003.Text = "" Exit Sub ElseIf kb_36109003.Text.Length = 0 Then MsgBox("kode barang harus tercantum") Exit Sub ElseIf nb_36109003.Text.Length = 0 Then MsgBox("nama barang harus tercantum") Exit Sub ElseIf hj_36109003.Text.Length = 0 Then MsgBox("harga jual harus tercantum") Exit Sub ElseIf jb_36109003.Text.Length = 0 Then MsgBox("jumlah barang harus tercantum") Exit Sub End If Dim soe As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109003.Text & "','" & nb_36109003.Text & "'," & Val(hj_36109003.Text) & "," & Val(jb_36109003.Text) & ")" anto = New OleDb.OleDbCommand(soe, ndut) ndut.Open() anto.ExecuteNonQuery() ndut.Close() anto.Dispose() kb_36109003.Text = "" nb_36109003.Text = "" hj_36109003.Text = "" jb_36109003.Text = "" End Sub End Class
Public Class Form27 Dim rusna As New ByIskandar.CariKeDataBaseByIskandar Dim cm As New OleDb.OleDbCommand Dim hma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub save_36109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save_36109010.Click If KB_36109010.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If NB_36109010.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(HJ_36109010.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(JB_36109010.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
rusna.AturPencarianDataBase("Barang", "KodeBarang", KB_36109010.Text, 1, hma) If rusna.JumlanBaris > 0 Then MsgBox("Adami kode barang seperti itu") Exit Sub End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & KB_36109010.Text & "','" & NB_36109010.Text & "'," & Val(HJ_36109010.Text) & "," & Val(JB_36109010.Text) & ")", hma) hma.Open() cm.ExecuteNonQuery() hma.Close() cm.Dispose()
KB_36109010.Text = "" NB_36109010.Text = "" HJ_36109010.Text = "" JB_36109010.Text = "" End Sub
Public Class Form27_36109028 Dim Tumim As New ByIskandar.CariKeDataBaseByIskandar Dim veny As New OleDb.OleDbCommand Dim vetom As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub s_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_36109028.Click If kb_36109028.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If nb_36109028.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(hj_36109028.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(jb_36109028.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
Tumim.AturPencarianDataBase("Barang", "KodeBarang", kb_36109028.Text, 1, vetom) If Tumim.JumlanBaris > 0 Then MsgBox("Adami kode barang seperti itu") Exit Sub End If
Public Class Form27 Dim DIEGO As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\DATABARANG.ACCDB")
Private Sub SIMPAN014_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN014.Click If KB014.Text.Length = 0 Then MsgBox("MASUKKAN KODE BARANG") Exit Sub End If
If NB014.Text.Length = 0 Then MsgBox("MASUKKAN NAMA BARANG") Exit Sub End If
If Val(HJ014.Text) = 0 Then MsgBox("MASUKKAN HARGA JUAL") Exit Sub End If
If Val(JB014.Text) = 0 Then MsgBox("MASUKKAN JUMLAH BARANG") Exit Sub End If
Dim XXX As New ByIskandar.CariKeDataBaseByIskandar XXX.AturPencarianDataBase("BARANG", "KODEBARANG", KB014.Text, 1, DIEGO) If XXX.JumlanBaris > 0 Then MsgBox(" KODE BARANG SUDAH ADA")
Exit Sub End If Dim ABC As New OleDb.OleDbCommand ABC = New OleDb.OleDbCommand("INSERT INTO BARANG(KODEBARANG,NAMABARANG,HARGAJUAL,JUMLAHBARANG) VALUES('" & KB014.Text & "','" & NB014.Text & "'," & Val(HJ014.Text) & "," & Val(JB014.Text) & ")", DIEGO)
Public Class Form27_36109001 Dim ninja As New ByIskandar.CariKeDataBaseByIskandar Dim rr As New OleDb.OleDbCommand Dim imps As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub ee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_36109001.Click If kb_36109001.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If nb_36109001.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(hj_36109001.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(jb_36109001.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
ninja.AturPencarianDataBase("Barang", "KodeBarang", kb_36109001.Text, 1, imps) If ninja.JumlanBaris > 0 Then MsgBox("Adami kode barang seperti itu") Exit Sub End If
Public Class Form27_36109006 Dim harun As New ByIskandar.CariKeDataBaseByIskandar Dim hrn As New OleDb.OleDbCommand Dim muhharun As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109006.Click If kb_36109006.Text.Length = 0 Then MsgBox("Isi yang kosong") Exit Sub End If
If nb_36109006.Text.Length = 0 Then MsgBox("Isi yang kosong") Exit Sub End If
If Val(hj_36109006.Text) = 0 Then MsgBox("Isi yang kosong") Exit Sub End If
If Val(jb_36109006.Text) = 0 Then MsgBox("Isi yang kosong") Exit Sub End If
harun.AturPencarianDataBase("Barang", "KodeBarang", kb_36109006.Text, 1, muhharun) If harun.JumlanBaris > 0 Then MsgBox("kode barang sudah ada") Exit Sub End If
Public Class Form27_36109001 Dim ninja As New ByIskandar.CariKeDataBaseByIskandar Dim rr As New OleDb.OleDbCommand Dim imps As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub ee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_36109001.Click If kb_36109001.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If nb_36109001.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(hj_36109001.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(jb_36109001.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
ninja.AturPencarianDataBase("Barang", "KodeBarang", kb_36109001.Text, 1, imps) If ninja.JumlanBaris > 0 Then MsgBox("Adami kode barang seperti itu") Exit Sub End If
Public Class Latihan27 Dim nini As New ByIskandar.CariKeDataBaseByIskandar Dim rani As New OleDb.OleDbCommand Dim nisa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE ='" & Application.StartupPath & "\Databarang.ACCDB'")
Private Sub simpan_008_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_008.Click If kb_008.Text.Length = 0 Then MsgBox("Isi dulue itu yang kosong") Exit Sub End If
If nb_008.Text.Length = 0 Then MsgBox("Isi dulue itu yang kosong") Exit Sub End If
If Val(hj_008.Text) = 0 Then MsgBox("Isi dulue itu yang kosong") Exit Sub End If
If Val(jb_008.Text) = 0 Then MsgBox("Isi dulue itu yang kosong") Exit Sub End If
nini.AturPencarianDataBase("Barang", "KodeBarang", kb_008.Text, 1, nisa) If nini.JumlanBaris > 0 Then MsgBox("Adami kode barang seperti itu") Exit Sub End If
36109022 Public Class Form27 Dim Rachmiyati As New ByIskandar.CariKeDataBaseByIskandar Dim ami As New OleDb.OleDbCommand Dim hma As New OleDb.OleDbConnection("PROVIDER=MICROSOFT.ACE.OLEDB.12.0;DATA SOURCE='" & Application.StartupPath & "\Databarang.ACCDB'") Private Sub simpan_36109022_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109022.Click
If kb_36109022.Text.Length = 0 Then MsgBox("isikan dlue eh") Exit Sub End If
If nb_36109022.Text.Length = 0 Then MsgBox("isikan dlue eh") Exit Sub End If
If Val(hj_36109022.Text) = 0 Then MsgBox("isikan dlue eh") Exit Sub End If
If Val(jb_36109022.Text) = 0 Then MsgBox("isikan dlue eh") Exit Sub End If
Rachmiyati.AturPencarianDataBase("Barang", "KodeBarang", kb_36109022.Text, 1, hma) If Rachmiyati.JumlanBaris > 0 Then MsgBox("sudah ada yang seperti itu") Exit Sub End If
ami = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109022.Text & "','" & nb_36109022.Text & "'," & Val(hj_36109022.Text) & "," & Val(jb_36109022.Text) & ")", hma) hma.Open() ami.ExecuteNonQuery() hma.Close() ami.Dispose()
kb_36109022.Text = "" nb_36109022.Text = "" hj_36109022.Text = "" jb_36109022.Text = "" End Sub
Private Sub Form27_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FORM27 Public Class Form27 Dim uthi As New ByIskandar.CariKeDataBaseByIskandar Dim ak As New OleDb.OleDbCommand Dim poltek As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109016_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109016.Click If kode36109016.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If nama36109016.Text.Length = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(harga36109016.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
If Val(jumlah36109016.Text) = 0 Then MsgBox("Isi rong itu yang kosong") Exit Sub End If
uthi.AturPencarianDataBase("Barang", "KodeBarang", kode36109016.Text, 1, poltek) If uthi.JumlanBaris > 0 Then MsgBox("Adami kode barang seperti itu") Exit Sub End If
ak = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kode36109016.Text & "','" & nama36109016.Text & "'," & Val(harga36109016.Text) & "," & Val(jumlah36109016.Text) & ")", poltek) poltek.Open() ak.ExecuteNonQuery() poltek.Close() ak.Dispose()
kode36109016.Text = "" nama36109016.Text = "" harga36109016.Text = "" jumlah36109016.Text = "" End Sub End Class
'dekklarasi connection Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb") Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub sim026_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sim026.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If Val(koba026.Text) = 0 Then 'untuk pencarian yg bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If naba026.Text.Length = 0 Then ' untuk pencarian yg bersifat huruf MsgBox("nama barang belum terisi") Exit Sub End If
If Val(haju026.Text) = 0 Then MsgBox("harga jual belum diisi") Exit Sub End If
If Val(juba026.Text) = 0 Then MsgBox("jumlah barang belum diisi") Exit Sub End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("BARANG", "KODEBARANG", koba026.Text, 1, conect)
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & koba026.Text & "','" & naba026.Text & "'," & Val(haju026.Text) & "," & Val(juba026.Text) & ")", conect)
Dim arman As New ByIskandar.CariKeDataBaseByIskandar
BalasHapusDim anto As New OleDb.OleDbCommand
Dim ndut As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub simpan_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109003.Click
arman.AturPencarianDataBase("Barang", "KodeBarang", kb_36109003.Text, 1, ndut)
If arman.JumlanBaris > 0 Then
MsgBox("kode barang telah ada")
kb_36109003.Text = ""
Exit Sub
ElseIf kb_36109003.Text.Length = 0 Then
MsgBox("kode barang harus tercantum")
Exit Sub
ElseIf nb_36109003.Text.Length = 0 Then
MsgBox("nama barang harus tercantum")
Exit Sub
ElseIf hj_36109003.Text.Length = 0 Then
MsgBox("harga jual harus tercantum")
Exit Sub
ElseIf jb_36109003.Text.Length = 0 Then
MsgBox("jumlah barang harus tercantum")
Exit Sub
End If
Dim soe As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109003.Text & "','" & nb_36109003.Text & "'," & Val(hj_36109003.Text) & "," & Val(jb_36109003.Text) & ")"
anto = New OleDb.OleDbCommand(soe, ndut)
ndut.Open()
anto.ExecuteNonQuery()
ndut.Close()
anto.Dispose()
kb_36109003.Text = ""
nb_36109003.Text = ""
hj_36109003.Text = ""
jb_36109003.Text = ""
End Sub
End Class
RUSNANINGSI R
BalasHapus36109010
Public Class Form27
Dim rusna As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim hma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub save_36109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save_36109010.Click
If KB_36109010.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If NB_36109010.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(HJ_36109010.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(JB_36109010.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
rusna.AturPencarianDataBase("Barang", "KodeBarang", KB_36109010.Text, 1, hma)
If rusna.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & KB_36109010.Text & "','" & NB_36109010.Text & "'," & Val(HJ_36109010.Text) & "," & Val(JB_36109010.Text) & ")", hma)
hma.Open()
cm.ExecuteNonQuery()
hma.Close()
cm.Dispose()
KB_36109010.Text = ""
NB_36109010.Text = ""
HJ_36109010.Text = ""
JB_36109010.Text = ""
End Sub
Public Class Form27_36109028
BalasHapusDim Tumim As New ByIskandar.CariKeDataBaseByIskandar
Dim veny As New OleDb.OleDbCommand
Dim vetom As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub s_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_36109028.Click
If kb_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
Tumim.AturPencarianDataBase("Barang", "KodeBarang", kb_36109028.Text, 1, vetom)
If Tumim.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
veny = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109028.Text & "','" & nb_36109028.Text & "'," & Val(hj_36109028.Text) & "," & Val(jb_36109028.Text) & ")", vetom)
vetom.Open()
veny.ExecuteNonQuery()
vetom.Close()
veny.Dispose()
kb_36109028.Text = ""
nb_36109028.Text = ""
hj_36109028.Text = ""
jb_36109028.Text = ""
End Sub
end class
Public Class Form27
BalasHapusDim DIEGO As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\DATABARANG.ACCDB")
Private Sub SIMPAN014_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN014.Click
If KB014.Text.Length = 0 Then
MsgBox("MASUKKAN KODE BARANG")
Exit Sub
End If
If NB014.Text.Length = 0 Then
MsgBox("MASUKKAN NAMA BARANG")
Exit Sub
End If
If Val(HJ014.Text) = 0 Then
MsgBox("MASUKKAN HARGA JUAL")
Exit Sub
End If
If Val(JB014.Text) = 0 Then
MsgBox("MASUKKAN JUMLAH BARANG")
Exit Sub
End If
Dim XXX As New ByIskandar.CariKeDataBaseByIskandar
XXX.AturPencarianDataBase("BARANG", "KODEBARANG", KB014.Text, 1, DIEGO)
If XXX.JumlanBaris > 0 Then
MsgBox(" KODE BARANG SUDAH ADA")
Exit Sub
End If
Dim ABC As New OleDb.OleDbCommand
ABC = New OleDb.OleDbCommand("INSERT INTO BARANG(KODEBARANG,NAMABARANG,HARGAJUAL,JUMLAHBARANG) VALUES('" & KB014.Text & "','" & NB014.Text & "'," & Val(HJ014.Text) & "," & Val(JB014.Text) & ")", DIEGO)
DIEGO.Open()
ABC.ExecuteNonQuery()
DIEGO.Close()
KB014.Text = ""
NB014.Text = ""
HJ014.Text = ""
JB014.Text = ""
End Sub
End Class
amelia indahsari
BalasHapus361 09 023
http://heiamee.blogspot.com/2011/11/form-27-29.html
Public Class Form27_36109001
BalasHapusDim ninja As New ByIskandar.CariKeDataBaseByIskandar
Dim rr As New OleDb.OleDbCommand
Dim imps As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub ee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_36109001.Click
If kb_36109001.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb_36109001.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj_36109001.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb_36109001.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
ninja.AturPencarianDataBase("Barang", "KodeBarang", kb_36109001.Text, 1, imps)
If ninja.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
rr = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109001.Text & "','" & nb_36109001.Text & "'," & Val(hj_36109001.Text) & "," & Val(jb_36109001.Text) & ")", imps)
imps.Open()
rr.ExecuteNonQuery()
imps.Close()
rr.Dispose()
kb_36109001.Text = ""
nb_36109001.Text = ""
hj_36109001.Text = ""
jb_36109001.Text = ""
End Sub
Private Sub Form27_36109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class Form27_36109006
BalasHapusDim harun As New ByIskandar.CariKeDataBaseByIskandar
Dim hrn As New OleDb.OleDbCommand
Dim muhharun As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109006.Click
If kb_36109006.Text.Length = 0 Then
MsgBox("Isi yang kosong")
Exit Sub
End If
If nb_36109006.Text.Length = 0 Then
MsgBox("Isi yang kosong")
Exit Sub
End If
If Val(hj_36109006.Text) = 0 Then
MsgBox("Isi yang kosong")
Exit Sub
End If
If Val(jb_36109006.Text) = 0 Then
MsgBox("Isi yang kosong")
Exit Sub
End If
harun.AturPencarianDataBase("Barang", "KodeBarang", kb_36109006.Text, 1, muhharun)
If harun.JumlanBaris > 0 Then
MsgBox("kode barang sudah ada")
Exit Sub
End If
hrn = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109006.Text & "','" & nb_36109006.Text & "'," & Val(hj_36109006.Text) & "," & Val(jb_36109006.Text) & ")", muhharun)
muhharun.Open()
hrn.ExecuteNonQuery()
muhharun.Close()
hrn.Dispose()
kb_36109006.Text = ""
nb_36109006.Text = ""
hj_36109006.Text = ""
jb_36109006.Text = ""
End Sub
Private Sub Form27_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class Form27_36109001
BalasHapusDim ninja As New ByIskandar.CariKeDataBaseByIskandar
Dim rr As New OleDb.OleDbCommand
Dim imps As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub ee_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_36109001.Click
If kb_36109001.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb_36109001.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj_36109001.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb_36109001.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
ninja.AturPencarianDataBase("Barang", "KodeBarang", kb_36109001.Text, 1, imps)
If ninja.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
rr = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109001.Text & "','" & nb_36109001.Text & "'," & Val(hj_36109001.Text) & "," & Val(jb_36109001.Text) & ")", imps)
imps.Open()
rr.ExecuteNonQuery()
imps.Close()
rr.Dispose()
kb_36109001.Text = ""
nb_36109001.Text = ""
hj_36109001.Text = ""
jb_36109001.Text = ""
End Sub
Private Sub Form27_36109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Latihan 27
BalasHapusPublic Class Latihan27
Dim nini As New ByIskandar.CariKeDataBaseByIskandar
Dim rani As New OleDb.OleDbCommand
Dim nisa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE ='" & Application.StartupPath & "\Databarang.ACCDB'")
Private Sub simpan_008_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_008.Click
If kb_008.Text.Length = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If
If nb_008.Text.Length = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If
If Val(hj_008.Text) = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If
If Val(jb_008.Text) = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If
nini.AturPencarianDataBase("Barang", "KodeBarang", kb_008.Text, 1, nisa)
If nini.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
rani = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_008.Text & "','" & nb_008.Text & "'," & Val(hj_008.Text) & "," & Val(jb_008.Text) & ")", nisa)
nisa.Open()
rani.ExecuteNonQuery()
nisa.Close()
rani.Dispose()
kb_008.Text = ""
nb_008.Text = ""
hj_008.Text = ""
jb_008.Text = ""
End Sub
Private Sub Latihan27_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Komentar ini telah dihapus oleh pengarang.
BalasHapusIsmi Febriani Asyikin
BalasHapus3a D3
361 09 005
http://ismifebriani.blogspot.com/2011/11/apkom-4-latihan-27-28.html
36109022
BalasHapusPublic Class Form27
Dim Rachmiyati As New ByIskandar.CariKeDataBaseByIskandar
Dim ami As New OleDb.OleDbCommand
Dim hma As New OleDb.OleDbConnection("PROVIDER=MICROSOFT.ACE.OLEDB.12.0;DATA SOURCE='" & Application.StartupPath & "\Databarang.ACCDB'")
Private Sub simpan_36109022_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109022.Click
If kb_36109022.Text.Length = 0 Then
MsgBox("isikan dlue eh")
Exit Sub
End If
If nb_36109022.Text.Length = 0 Then
MsgBox("isikan dlue eh")
Exit Sub
End If
If Val(hj_36109022.Text) = 0 Then
MsgBox("isikan dlue eh")
Exit Sub
End If
If Val(jb_36109022.Text) = 0 Then
MsgBox("isikan dlue eh")
Exit Sub
End If
Rachmiyati.AturPencarianDataBase("Barang", "KodeBarang", kb_36109022.Text, 1, hma)
If Rachmiyati.JumlanBaris > 0 Then
MsgBox("sudah ada yang seperti itu")
Exit Sub
End If
ami = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109022.Text & "','" & nb_36109022.Text & "'," & Val(hj_36109022.Text) & "," & Val(jb_36109022.Text) & ")", hma)
hma.Open()
ami.ExecuteNonQuery()
hma.Close()
ami.Dispose()
kb_36109022.Text = ""
nb_36109022.Text = ""
hj_36109022.Text = ""
jb_36109022.Text = ""
End Sub
Private Sub Form27_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
http://aminurul.blogspot.com/2011/11/form-27-31b.html
BalasHapusHASTUTI
BalasHapus36109016
FORM27
Public Class Form27
Dim uthi As New ByIskandar.CariKeDataBaseByIskandar
Dim ak As New OleDb.OleDbCommand
Dim poltek As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109016_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109016.Click
If kode36109016.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nama36109016.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(harga36109016.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jumlah36109016.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
uthi.AturPencarianDataBase("Barang", "KodeBarang", kode36109016.Text, 1, poltek)
If uthi.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
ak = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kode36109016.Text & "','" & nama36109016.Text & "'," & Val(harga36109016.Text) & "," & Val(jumlah36109016.Text) & ")", poltek)
poltek.Open()
ak.ExecuteNonQuery()
poltek.Close()
ak.Dispose()
kode36109016.Text = ""
nama36109016.Text = ""
harga36109016.Text = ""
jumlah36109016.Text = ""
End Sub
End Class
ANDI WAHYUNI
BalasHapus361 09 019
http://wahyunistrongggg.blogspot.com/2011/11/latihan-27-32.html
Public Class form27
BalasHapus'dekklarasi connection
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb")
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub sim026_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sim026.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If Val(koba026.Text) = 0 Then 'untuk pencarian yg bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If naba026.Text.Length = 0 Then ' untuk pencarian yg bersifat huruf
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(haju026.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(juba026.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("BARANG", "KODEBARANG", koba026.Text, 1, conect)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & koba026.Text & "','" & naba026.Text & "'," & Val(haju026.Text) & "," & Val(juba026.Text) & ")", conect)
conect.Open()
com.ExecuteNonQuery()
conect.Close()
com.Dispose()
koba026.Text = ""
naba026.Text = ""
haju026.Text = ""
juba026.Text = ""
End Sub
End Class