Public Class Form27 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click 'Memeriksa isi textbox' If KB_076.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If NB_076.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If Val(HJ_076.Text) = 0 Then MsgBox("Masukkan Harga barang") Exit Sub End If
If Val(JB_076.Text) = 0 Then MsgBox("Masukkan jumlah barang") Exit Sub End If
'Memeriksa keberadaan kodebarang' Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "KodeBarang", KB_076.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
'Proses Menyimpan' Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_076.Text & "', '" & NB_076.Text & "', " & Val(HJ_076.Text) & ", " & Val(JB_076.Text) & ")", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
'Mengosongkan isi textbox' KB_076.Text = "" NB_076.Text = "" HJ_076.Text = "" JB_076.Text = "" End Sub End Class
Public Class LATIHAN027084 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub simpan_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_084.Click 'Memeriksa isi textbox' If kb_084.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If nb_084.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If Val(hj_084.Text) = 0 Then MsgBox("Masukkan Harga barang") Exit Sub End If
If Val(jb_084.Text) = 0 Then MsgBox("Masukkan jumlah barang") Exit Sub End If
'Memeriksa keberadaan kodebarang' Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "KodeBarang", kb_084.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
'Proses Menyimpan' Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_084.Text & "', '" & nb_084.Text & "', " & Val(hj_084.Text) & ", " & Val(jb_084.Text) & ")", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
'Mengosongkan isi textbox' kb_084.Text = "" nb_084.Text = "" hj_084.Text = "" jb_084.Text = "" End Sub End Class
Public Class Latihan27 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click 'Memeriksa isi textbox' If kb070.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If nb070.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If Val(hj070.Text) = 0 Then MsgBox("Masukkan Harga barang") Exit Sub End If
If Val(jb070.Text) = 0 Then MsgBox("Masukkan jumlah barang") Exit Sub End If
'Memeriksa keberadaan kodebarang' Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "KodeBarang", kb070.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
'Proses Menyimpan' Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb070.Text & "', '" & nb070.Text & "', " & Val(hj070.Text) & ", " & Val(jb070.Text) & ")", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
'Mengosongkan isi textbox' kb070.Text = "" nb070.Text = "" hj070.Text = "" jb070.Text = "" End Sub End Class
Public Class Form27 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click 'Memeriksa isi textbox' If KB_064.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If NB_064.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If Val(HJ_064.Text) = 0 Then MsgBox("Masukkan Harga barang") Exit Sub End If
If Val(JB_064.Text) = 0 Then MsgBox("Masukkan jumlah barang") Exit Sub End If
'Memeriksa keberadaan kodebarang' Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "KodeBarang", KB_064.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
'Proses Menyimpan' Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_064.Text & "', '" & NB_064.Text & "', " & Val(HJ_064.Text) & ", " & Val(JB_064.Text) & ")", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
'Mengosongkan isi textbox' KB_064.Text = "" NB_064.Text = "" HJ_064.Text = "" JB_064.Text = "" End Sub
Public Class LATIHAN027068 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'Memeriksa isi textbox' If kb068.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If If nb068.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub
End If If Val(hj068.Text) = 0 Then MsgBox("Masukkan Harga barang") Exit Sub End If
If Val(jb068.Text) = 0 Then MsgBox("Masukkan jumlah barang") Exit Sub End If
'Memeriksa keberadaan kodebarang' Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "KodeBarang", kb068.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
'Proses Menyimpan' Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb068.Text & "', '" & nb068.Text & "', " & Val(hj068.Text) & ", " & Val(jb068.Text) & ")", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
'Mengosongkan isi textbox' kb068.Text = "" nb068.Text = "" hj068.Text = "" jb068.Text = "" End Sub End Class
Public Class latihan_27 Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha") Dim browse As New DataTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim danang As New OleDb.OleDbDataAdapter("select count(*) as coba from barang where kodebarang ='" & kobar069.Text & "'", CONECT) browse.Rows.Clear() danang.Fill(browse) If browse.Rows(0).Item("coba") > 0 Then MsgBox("kode barang sudah ada") Else prayudha() End If Data()
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kobar069.Text & "','" & nabar069.Text & "'," & Val(harju069.Text) & "," & Val(jubar069.Text) & ")", CONECT)
Public Sub data() If Val(kobar069.Text) = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If If nabar069.Text.Length = 0 Then MsgBox("nama barang belum terisi") Exit Sub End If
If Val(harju069.Text) = 0 Then MsgBox("harga jual belum diisi") Exit Sub End If
If Val(jubar069.Text) = 0 Then MsgBox("jumlah barang belum diisi") Exit Sub End If End Sub
End Class
Public Class latihan_28a Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha") Dim danang As New DataTable Dim baris As DataRow
Private Sub latihan_28a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim coba As New OleDb.OleDbDataAdapter coba = New OleDb.OleDbDataAdapter("select * from barang", CONECT) coba.Fill(danang) DataGridView1.DataSource = danang
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If latihan_28b.Visible = False Then latihan_28b.Show() Else latihan_28b.Activate() End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click End End Sub End Class
Public Class Form27 Dim I As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb") Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If c1.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If If c2.Text.Length = 0 Then MsgBox("masukkan harga barang") Exit Sub End If If Val(c3.Text) = 0 Then MsgBox("masukkan harga barang") Exit Sub End If If Val(c4.Text) = 0 Then MsgBox("masukkan jumlah barang") Exit Sub End If Dim cari As New ByIskandar.CariKeDataBaseByIskandar cari.AturPencarianDataBase("Barang", "KodeBarang", c1.Text, 1, I) If cari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If Dim CI As New OleDb.OleDbCommand CI = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL,JUMLAHBARANG) VALUES ('" & c1.Text & "', '" & c2.Text & "', " & Val(c3.Text) & ")", I) I.Open() CI.ExecuteNonQuery() I.Close() CI.Dispose() c1.Text = "" c2.Text = "" c3.Text = "" c4.Text = "" End Sub End Class
Public Class Form28A Dim I As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable
Public Sub keket() Dim Z As New OleDb.OleDbDataAdapter Z = New OleDb.OleDbDataAdapter("select * From BARANG", I) datatabel1.Rows.Clear() Z.Fill(datatabel1) Z.Dispose()
End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load keket() DataGridView1.DataSource = datatabel1 End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If Form28B.Visible = False Then Form28B.Show() Else Form28B.Activate()
End If Form28B.Show() 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 Form28B
Dim I As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;DATA Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If c1.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If c2.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If If Val(c3.Text) = 0 Then MsgBox("masukkan harga barang") Exit Sub End If
If Val(c4.Text) = 0 Then MsgBox("masukkan jumlah barang") Exit Sub End If
Dim cari As New ByIskandar.CariKeDataBaseByIskandar cari.AturPencarianDataBase("Barang", "KodeBarang", c1.Text, 1, I) If cari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim CI As New OleDb.OleDbCommand CI = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & c1.Text & "', '" & c2.Text & "', '" & c3.Text & "', " & Val(c4.Text) & ")", I) I.Open() CI.ExecuteNonQuery() I.Close() CI.Dispose()
Public Class latihan_27 Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha") Dim browse As New DataTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim danang As New OleDb.OleDbDataAdapter("select count(*) as coba from barang where kodebarang ='" & kobar069.Text & "'", CONECT) browse.Rows.Clear() danang.Fill(browse) If browse.Rows(0).Item("coba") > 0 Then MsgBox("kode barang sudah ada") Else prayudha() End If Data()
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kobar069.Text & "','" & nabar069.Text & "'," & Val(harju069.Text) & "," & Val(jubar069.Text) & ")", CONECT)
Public Sub data() If Val(kobar069.Text) = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If If nabar069.Text.Length = 0 Then MsgBox("nama barang belum terisi") Exit Sub End If
If Val(harju069.Text) = 0 Then MsgBox("harga jual belum diisi") Exit Sub End If
If Val(jubar069.Text) = 0 Then MsgBox("jumlah barang belum diisi") Exit Sub End If End Sub
Public Class Form27
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
'Memeriksa isi textbox'
If KB_076.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If NB_076.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If Val(HJ_076.Text) = 0 Then
MsgBox("Masukkan Harga barang")
Exit Sub
End If
If Val(JB_076.Text) = 0 Then
MsgBox("Masukkan jumlah barang")
Exit Sub
End If
'Memeriksa keberadaan kodebarang'
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "KodeBarang", KB_076.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
'Proses Menyimpan'
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_076.Text & "', '" & NB_076.Text & "', " & Val(HJ_076.Text) & ", " & Val(JB_076.Text) & ")", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
'Mengosongkan isi textbox'
KB_076.Text = ""
NB_076.Text = ""
HJ_076.Text = ""
JB_076.Text = ""
End Sub
End Class
FITRAH ADITYA HANAPI (36109084)
BalasHapusPublic Class LATIHAN027084
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub simpan_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_084.Click
'Memeriksa isi textbox'
If kb_084.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If nb_084.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If Val(hj_084.Text) = 0 Then
MsgBox("Masukkan Harga barang")
Exit Sub
End If
If Val(jb_084.Text) = 0 Then
MsgBox("Masukkan jumlah barang")
Exit Sub
End If
'Memeriksa keberadaan kodebarang'
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "KodeBarang", kb_084.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
'Proses Menyimpan'
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_084.Text & "', '" & nb_084.Text & "', " & Val(hj_084.Text) & ", " & Val(jb_084.Text) & ")", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
'Mengosongkan isi textbox'
kb_084.Text = ""
nb_084.Text = ""
hj_084.Text = ""
jb_084.Text = ""
End Sub
End Class
Public Class Latihan27
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
'Memeriksa isi textbox'
If kb070.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If nb070.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If Val(hj070.Text) = 0 Then
MsgBox("Masukkan Harga barang")
Exit Sub
End If
If Val(jb070.Text) = 0 Then
MsgBox("Masukkan jumlah barang")
Exit Sub
End If
'Memeriksa keberadaan kodebarang'
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "KodeBarang", kb070.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
'Proses Menyimpan'
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb070.Text & "', '" & nb070.Text & "', " & Val(hj070.Text) & ", " & Val(jb070.Text) & ")", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
'Mengosongkan isi textbox'
kb070.Text = ""
nb070.Text = ""
hj070.Text = ""
jb070.Text = ""
End Sub
End Class
feby winriani syam
BalasHapusPublic Class Form27
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
'Memeriksa isi textbox'
If KB_064.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If NB_064.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If Val(HJ_064.Text) = 0 Then
MsgBox("Masukkan Harga barang")
Exit Sub
End If
If Val(JB_064.Text) = 0 Then
MsgBox("Masukkan jumlah barang")
Exit Sub
End If
'Memeriksa keberadaan kodebarang'
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "KodeBarang", KB_064.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
'Proses Menyimpan'
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KB_064.Text & "', '" & NB_064.Text & "', " & Val(HJ_064.Text) & ", " & Val(JB_064.Text) & ")", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
'Mengosongkan isi textbox'
KB_064.Text = ""
NB_064.Text = ""
HJ_064.Text = ""
JB_064.Text = ""
End Sub
End Class
Public Class LATIHAN027068
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Memeriksa isi textbox'
If kb068.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If nb068.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If Val(hj068.Text) = 0 Then
MsgBox("Masukkan Harga barang")
Exit Sub
End If
If Val(jb068.Text) = 0 Then
MsgBox("Masukkan jumlah barang")
Exit Sub
End If
'Memeriksa keberadaan kodebarang'
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "KodeBarang", kb068.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
'Proses Menyimpan'
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb068.Text & "', '" & nb068.Text & "', " & Val(hj068.Text) & ", " & Val(jb068.Text) & ")", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
'Mengosongkan isi textbox'
kb068.Text = ""
nb068.Text = ""
hj068.Text = ""
jb068.Text = ""
End Sub
End Class
Public Class latihan_27
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha")
Dim browse As New DataTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim danang As New OleDb.OleDbDataAdapter("select count(*) as coba from barang where kodebarang ='" & kobar069.Text & "'", CONECT)
browse.Rows.Clear()
danang.Fill(browse)
If browse.Rows(0).Item("coba") > 0 Then
MsgBox("kode barang sudah ada")
Else
prayudha()
End If
Data()
kobar069.Text = ""
nabar069.Text = ""
harju069.Text = ""
jubar069.Text = ""
End Sub
Public Sub prayudha()
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kobar069.Text & "','" & nabar069.Text & "'," & Val(harju069.Text) & "," & Val(jubar069.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
End Sub
Public Sub data()
If Val(kobar069.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If nabar069.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(harju069.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(jubar069.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
End Sub
End Class
Public Class latihan_28a
Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha")
Dim danang As New DataTable
Dim baris As DataRow
Private Sub latihan_28a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim coba As New OleDb.OleDbDataAdapter
coba = New OleDb.OleDbDataAdapter("select * from barang", CONECT)
coba.Fill(danang)
DataGridView1.DataSource = danang
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If latihan_28b.Visible = False Then
latihan_28b.Show()
Else
latihan_28b.Activate()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
End
End Sub
End Class
Public Class Form27
BalasHapusDim I As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If c1.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If c2.Text.Length = 0 Then
MsgBox("masukkan harga barang")
Exit Sub
End If
If Val(c3.Text) = 0 Then
MsgBox("masukkan harga barang")
Exit Sub
End If
If Val(c4.Text) = 0 Then
MsgBox("masukkan jumlah barang")
Exit Sub
End If
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
cari.AturPencarianDataBase("Barang", "KodeBarang", c1.Text, 1, I)
If cari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim CI As New OleDb.OleDbCommand
CI = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL,JUMLAHBARANG) VALUES ('" & c1.Text & "', '" & c2.Text & "', " & Val(c3.Text) & ")", I)
I.Open()
CI.ExecuteNonQuery()
I.Close()
CI.Dispose()
c1.Text = ""
c2.Text = ""
c3.Text = ""
c4.Text = ""
End Sub
End Class
Public Class Form28A
BalasHapusDim I As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub keket()
Dim Z As New OleDb.OleDbDataAdapter
Z = New OleDb.OleDbDataAdapter("select * From BARANG", I)
datatabel1.Rows.Clear()
Z.Fill(datatabel1)
Z.Dispose()
End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
keket()
DataGridView1.DataSource = datatabel1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Form28B.Visible = False Then
Form28B.Show()
Else
Form28B.Activate()
End If
Form28B.Show()
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 Form28B
Dim I As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;DATA Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If c1.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If c2.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If Val(c3.Text) = 0 Then
MsgBox("masukkan harga barang")
Exit Sub
End If
If Val(c4.Text) = 0 Then
MsgBox("masukkan jumlah barang")
Exit Sub
End If
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
cari.AturPencarianDataBase("Barang", "KodeBarang", c1.Text, 1, I)
If cari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim CI As New OleDb.OleDbCommand
CI = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & c1.Text & "', '" & c2.Text & "', '" & c3.Text & "', " & Val(c4.Text) & ")", I)
I.Open()
CI.ExecuteNonQuery()
I.Close()
CI.Dispose()
c1.Text = ""
c2.Text = ""
c3.Text = ""
c4.Text = ""
Form28A.keket()
End Sub
End Class
Public Class latihan_27
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha")
Dim browse As New DataTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim danang As New OleDb.OleDbDataAdapter("select count(*) as coba from barang where kodebarang ='" & kobar069.Text & "'", CONECT)
browse.Rows.Clear()
danang.Fill(browse)
If browse.Rows(0).Item("coba") > 0 Then
MsgBox("kode barang sudah ada")
Else
prayudha()
End If
Data()
kobar069.Text = ""
nabar069.Text = ""
harju069.Text = ""
jubar069.Text = ""
End Sub
Public Sub prayudha()
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into BARANG (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kobar069.Text & "','" & nabar069.Text & "'," & Val(harju069.Text) & "," & Val(jubar069.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
End Sub
Public Sub data()
If Val(kobar069.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If nabar069.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(harju069.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(jubar069.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
End Sub
End Class