Public Class Form28A Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable
Public Sub PUTRA() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", A) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose() End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load PUTRA() DGV028A.DataSource = datatabel1 End Sub
Private Sub INPUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUT.Click If Form28B.Visible = False Then Form28B.Show() Else Form28B.Activate() End If
Form28B.Show() End Sub
Private Sub TUTUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TUTUP.Click Me.Close() End Sub End Class
Public Class Form28B 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 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
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
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()
Public Class LATIHAN028A084 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable Public Sub Deriel() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", A) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose()
End Sub Private Sub LATIHAN028A084_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Deriel() dgv_084.DataSource = datatabel1
End Sub
Private Sub input_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles input_084.Click If LATIHAN028B084.Visible = False Then LATIHAN028B084.Show() Else LATIHAN028B084.Activate() End If
LATIHAN028B084.Show() End Sub
Private Sub ttp_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ttp_084.Click Me.Close() End Sub End Class
Public Class LATIHAN028B084 Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Button_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_084.Click 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
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
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()
Public Class Latihan28A Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable
Public Sub by() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", A) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose() End Sub
Private Sub Latihan28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load by() dgv070A.DataSource = datatabel1 End Sub
Private Sub input070_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles input070.Click If Latihan28B.Visible = False Then Latihan28B.Show() Else Latihan28B.Activate() End If
Latihan28B.Show() End Sub
Private Sub tutup070_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tutup070.Click Me.Close() End Sub End Class
Public Class Latihan28B 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 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
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
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()
Public Class Form28A Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable
Public Sub feby() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", A) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose() End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load feby() DGV064.DataSource = datatabel1 End Sub
Private Sub INPUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUT.Click If Form28B.Visible = False Then Form28B.Show() Else Form28B.Activate() End If
Form28B.Show() End Sub
Private Sub TUTUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TUTUP.Click Me.Close() End Sub
End Class
Public Class Form28B 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 SAVE.Click 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
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
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()
Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb") Dim datatabel1 As New DataTable
Public Sub ina() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select * From BARANG", n) datatabel1.Rows.Clear() X.Fill(datatabel1) X.Dispose() End Sub
Private Sub Latihan028A077_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ina() DVG28A.DataSource = datatabel1 End Sub
Private Sub INPUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUT.Click If Latihan028B077.Visible = False Then Latihan028B077.Show() Else Latihan028B077.Activate() End If
Latihan028B077.Show() End Sub
Private Sub TUTUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TUTUP.Click Me.Close() End Sub End Class
Public Class Latihan028B077
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 If KBrg077.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If Nbrg077.Text.Length = 0 Then MsgBox("data sudah ada") Exit Sub End If
If Val(Hjual077.Text) = 0 Then MsgBox("Masukkan Harga barang") Exit Sub End If
If Val(JBrg077.Text) = 0 Then MsgBox("Masukkan jumlah barang") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "KodeBarang", KBrg077.Text, 1, A) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KBrg077.Text & "', '" & Nbrg077.Text & "', " & Val(Hjual077.Text) & ", " & Val(JBrg077.Text) & ")", A) A.Open() CM.ExecuteNonQuery() A.Close() CM.Dispose()
Public Class Latihan28A_071 Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB") Dim take As New DataTable Public Sub ambildata() 'mendeklarasikan adapter Dim data As New OleDb.OleDbDataAdapter
'mengatur data yang akan diangkut data = New OleDb.OleDbDataAdapter("SELECT* from barang", go)
'bersihkan data sebelum mengisi data lain take.Rows.Clear()
'memasukkan data yg telah diambil ke dalam data grid view data.Fill(take) data.Dispose()
End Sub
Private Sub Latihan28A_071_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ambildata() DGV_071.DataSource = take End Sub
Private Sub Input_071_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Input_071.Click 'menampilkan form latihan28b If Latihan28B_071.Visible = False Then Latihan28B_071.Show() Else Latihan28B_071.Activate() End If
End Sub
Private Sub Close_071_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Close_071.Click Me.Close() End Sub End Class
Form 28B Public Class Latihan28B_071 Dim go 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 'perintah periksa data If kb_071.Text.Length = 0 Then MsgBox("Please Insert Your Text") Exit Sub End If
If nb_071.Text.Length = 0 Then MsgBox("Please Insert Your Text") Exit Sub End If
If Val(hj_071.Text) = 0 Then MsgBox("Please Insert Your Text") Exit Sub End If
If Val(jb_071.Text) = 0 Then MsgBox("Please Insert Your Text") Exit Sub End If
'perintah ambil data Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb_071.Text, 1, go)
If PENCARI.JumlanBaris > 0 Then MsgBox("The data has been exist please insert new data")
'mengosongkan text box kb_071.Text = " " nb_071.Text = " " hj_071.Text = " " jb_071.Text = " " Exit Sub End If
'deklarasi object command Dim Cm As New OleDb.OleDbCommand Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_071.Text & "','" & nb_071.Text & "', " & Val(hj_071.Text) & "," & Val(jb_071.Text) & ")", go) go.Open() Cm.ExecuteNonQuery() go.Close() Cm.Dispose()
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 latihan_28b Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha") Dim dt 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) dt.Rows.Clear() danang.Fill(dt) If dt.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
Private Sub LATIHAN028B36109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Public Class Form28A
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub PUTRA()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", A)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PUTRA()
DGV028A.DataSource = datatabel1
End Sub
Private Sub INPUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUT.Click
If Form28B.Visible = False Then
Form28B.Show()
Else
Form28B.Activate()
End If
Form28B.Show()
End Sub
Private Sub TUTUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TUTUP.Click
Me.Close()
End Sub
End Class
Public Class Form28B
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
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
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
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()
KB_076.Text = ""
NB_076.Text = ""
HJ_076.Text = ""
JB_076.Text = ""
Form28A.PUTRA()
End Sub
End Class
FITRAH ADITYA H.
BalasHapusPublic Class LATIHAN028A084
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub Deriel()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", A)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub LATIHAN028A084_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Deriel()
dgv_084.DataSource = datatabel1
End Sub
Private Sub input_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles input_084.Click
If LATIHAN028B084.Visible = False Then
LATIHAN028B084.Show()
Else
LATIHAN028B084.Activate()
End If
LATIHAN028B084.Show()
End Sub
Private Sub ttp_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ttp_084.Click
Me.Close()
End Sub
End Class
Public Class LATIHAN028B084
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\DATABARANG.accdb")
Private Sub Button_084_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_084.Click
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
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
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()
kb_084.Text = ""
nb_084.Text = ""
hj_084.Text = ""
jb_084.Text = ""
LATIHAN028A084.Deriel()
End Sub
End Class
Public Class Latihan28A
BalasHapusDim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub by()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", A)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub Latihan28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
by()
dgv070A.DataSource = datatabel1
End Sub
Private Sub input070_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles input070.Click
If Latihan28B.Visible = False Then
Latihan28B.Show()
Else
Latihan28B.Activate()
End If
Latihan28B.Show()
End Sub
Private Sub tutup070_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tutup070.Click
Me.Close()
End Sub
End Class
Public Class Latihan28B
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
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
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
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()
kb070.Text = ""
nb070.Text = ""
hj070.Text = ""
jb070.Text = ""
Latihan28A.by()
End Sub
End Class
feby winriani syam
BalasHapusPublic Class Form28A
Dim A As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub feby()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", A)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
feby()
DGV064.DataSource = datatabel1
End Sub
Private Sub INPUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUT.Click
If Form28B.Visible = False Then
Form28B.Show()
Else
Form28B.Activate()
End If
Form28B.Show()
End Sub
Private Sub TUTUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TUTUP.Click
Me.Close()
End Sub
End Class
Public Class Form28B
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 SAVE.Click
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
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
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()
KB_064.Text = ""
NB_064.Text = ""
HJ_064.Text = ""
JB_064.Text = ""
Form28A.feby()
End Sub
End Class
Muhammad Nur
BalasHapusPublic Class Latihan028A077
Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATABARANG.accdb")
Dim datatabel1 As New DataTable
Public Sub ina()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select * From BARANG", n)
datatabel1.Rows.Clear()
X.Fill(datatabel1)
X.Dispose()
End Sub
Private Sub Latihan028A077_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ina()
DVG28A.DataSource = datatabel1
End Sub
Private Sub INPUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUT.Click
If Latihan028B077.Visible = False Then
Latihan028B077.Show()
Else
Latihan028B077.Activate()
End If
Latihan028B077.Show()
End Sub
Private Sub TUTUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TUTUP.Click
Me.Close()
End Sub
End Class
Public Class Latihan028B077
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
If KBrg077.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If Nbrg077.Text.Length = 0 Then
MsgBox("data sudah ada")
Exit Sub
End If
If Val(Hjual077.Text) = 0 Then
MsgBox("Masukkan Harga barang")
Exit Sub
End If
If Val(JBrg077.Text) = 0 Then
MsgBox("Masukkan jumlah barang")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "KodeBarang", KBrg077.Text, 1, A)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & KBrg077.Text & "', '" & Nbrg077.Text & "', " & Val(Hjual077.Text) & ", " & Val(JBrg077.Text) & ")", A)
A.Open()
CM.ExecuteNonQuery()
A.Close()
CM.Dispose()
KBrg077.Text = ""
Nbrg077.Text = ""
Hjual077.Text = ""
JBrg077.Text = ""
Latihan028A077.ina()
End Sub
End Class
Form 28A
BalasHapusPublic Class Latihan28A_071
Dim go As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\DataBarang.ACCDB")
Dim take As New DataTable
Public Sub ambildata()
'mendeklarasikan adapter
Dim data As New OleDb.OleDbDataAdapter
'mengatur data yang akan diangkut
data = New OleDb.OleDbDataAdapter("SELECT* from barang", go)
'bersihkan data sebelum mengisi data lain
take.Rows.Clear()
'memasukkan data yg telah diambil ke dalam data grid view
data.Fill(take)
data.Dispose()
End Sub
Private Sub Latihan28A_071_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambildata()
DGV_071.DataSource = take
End Sub
Private Sub Input_071_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Input_071.Click
'menampilkan form latihan28b
If Latihan28B_071.Visible = False Then
Latihan28B_071.Show()
Else
Latihan28B_071.Activate()
End If
End Sub
Private Sub Close_071_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Close_071.Click
Me.Close()
End Sub
End Class
Form 28B
Public Class Latihan28B_071
Dim go 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
'perintah periksa data
If kb_071.Text.Length = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If nb_071.Text.Length = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If Val(hj_071.Text) = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
If Val(jb_071.Text) = 0 Then
MsgBox("Please Insert Your Text")
Exit Sub
End If
'perintah ambil data
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", kb_071.Text, 1, go)
If PENCARI.JumlanBaris > 0 Then
MsgBox("The data has been exist please insert new data")
'mengosongkan text box
kb_071.Text = " "
nb_071.Text = " "
hj_071.Text = " "
jb_071.Text = " "
Exit Sub
End If
'deklarasi object command
Dim Cm As New OleDb.OleDbCommand
Cm = New OleDb.OleDbCommand("INSERT INTO BARANG (KODEBARANG, NAMABARANG, HARGAJUAL, JUMLAHBARANG) VALUES ('" & kb_071.Text & "','" & nb_071.Text & "', " & Val(hj_071.Text) & "," & Val(jb_071.Text) & ")", go)
go.Open()
Cm.ExecuteNonQuery()
go.Close()
Cm.Dispose()
'mengosongkan text box
kb_071.Text = " "
nb_071.Text = " "
hj_071.Text = " "
jb_071.Text = " "
'menjalankan procedure pengambilan data
Latihan28A_071.ambildata()
'menutup form
Me.Close()
End Sub
End Class
Public Class latihan_28a
BalasHapusDim 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 latihan_28b
Dim CONECT As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;Jet OLEDB:Database Password=danangprayudha")
Dim dt 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)
dt.Rows.Clear()
danang.Fill(dt)
If dt.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
Private Sub LATIHAN028B36109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class