Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=015") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan036_46109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim imah As New OleDb.OleDbDataAdapter imah = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & kb46109015.Text & "'", CONECT) DT.Rows.Clear() imah.Fill(DT) dgv46109015.DataSource = DT
imah.Dispose()
Dim ima(1) As DataColumn ima(0) = DT.Columns("NOTRANS") DT.PrimaryKey = ima End Sub
Private Sub t46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t46109015.Click If kb46109015.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(u46109015.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
Dim drzany As DataRow drzany = DT.NewRow drzany("KODEBARANG") = kb46109015.Text drzany("UNIT") = u46109015.Text drzany("HARGA") = h46109015.Text
DT.Rows.Add(drzany)
kb46109015.Text = "" u46109015.Text = "" h46109015.Text = "" Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "KodeBarang", kb46109015.Text, 1, CONECT) If pencari.JumlanBaris > 0 Then MsgBox("Data yang anda masukkan telah ada") Exit Sub End If End Sub
Private Sub s46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s46109015.Click If nt46109015.Text.Length = 0 Then MsgBox("no.transaksi belum terisi") Exit Sub End If If jt46109015.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109015.Text & "',#" & tgl46109015.Value.Date & "#," & Val(jt46109015.Text) & ")", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close()
For Each r As DataRow In DT.Rows com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & nt46109015.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close() com.Dispose() Next
DT.Rows.Clear() nt46109015.Text = "" jt46109015.Text = "" End Sub End Class
Public Class TUGAS36 Dim SRY As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DataMajemuk.accdb;Jet OLEDB:Database Password=11") Dim REJEKI As New DataTable Dim CARI As New ByIskandar.CariKeDataBaseByIskandar
Private Sub TUGAS36_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Q As New OleDb.OleDbDataAdapter Q = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA from detailtransaksi where notrans = '" & T146109006.Text & "'", SRY) Q.Fill(REJEKI) Q.Dispose()
DGV46109006.DataSource = REJEKI
Dim KIKI(1) As DataColumn KIKI(0) = REJEKI.Columns("NOTRANS") REJEKI.PrimaryKey = KIKI
End Sub
Private Sub TOMBOL1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL1.Click If KB.Text.Length = 0 Then MsgBox("Kode Barang belum terisi") Exit Sub End If
If Val(UN.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(HR.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
Private Sub TOMBOL2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL2.Click If T146109006.Text.Length = 0 Then MsgBox("no.transaksi belum terisi") Exit Sub End If
If T246109006.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=12345") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan3646109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim itha As New OleDb.OleDbDataAdapter itha = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & kb46109047.Text & "'", CONECT) DT.Rows.Clear() itha.Fill(DT) DataGridView1.DataSource = DT
itha.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb46109047.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(un46109047.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(hr46109047.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TB146109047.Text & "',#" & DTP46109047.Value.Date & "#," & Val(TB246109047.Text) & ")", CONECT)
andi novindra batari 46109042 Public Class LATIHAN0360042 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=8")
Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If KB.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(UN.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(HR.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("barang", "kodebarang", kb.Text, 1, CONECT) If pencari.JumlanBaris > 0 Then MsgBox("data yang ada masukkan telah ada") Exit Sub End If End Sub
Private Sub LATIHAN0360042_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nisa As New OleDb.OleDbDataAdapter nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & kb.Text & "'", CONECT) DT.Rows.Clear() nisa.Fill(DT) DataGridView1.DataSource = DT
nisa.Dispose()
Dim novi(1) As DataColumn novi(0) = DT.Columns("notrans") DT.PrimaryKey = novi
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox1.Text.Length = 0 Then MsgBox("no.transaksi belum terisi") Exit Sub End If
If TextBox2.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(TextBox2.Text) & ")", CONECT)
Public Class LATIHAN036_46109010 Dim faradillah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46")
Dim fara As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN035_46109010_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rossi As New OleDb.OleDbDataAdapter rossi = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & KB46109010.Text & "'", faradillah) fara.Rows.Clear() rossi.Fill(fara) dgv46109010.DataSource = fara
rossi.Dispose()
Dim farah(1) As DataColumn farah(0) = fara.Columns("KODEBARANG") fara.PrimaryKey = farah
End Sub
Private Sub Button146109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109010.Click
If KB46109010.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(UN46109010.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(HR46109010.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
fara.Rows.Add(rivai) If rivai Is Nothing Then rivai = fara.NewRow rivai("KODEBARANG") = kb46109010.Text Else MsgBox("Maaf kode barang sudah ada") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("Barang", "KodeBarang", kb46109010.Text, 1, faradillah) If pencari.JumlanBaris > 0 Then MsgBox("data yang anda masukkan telah ada") Exit Sub End If
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If fara.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109010.Text & "',#" & dtp46109010.Value.Date & "#," & Val(jt46109010.Text) & ")", faradillah)
Dim CONECT AsNew OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= "& Application.StartupPath &"\DATAMAJEMUK.accdb;jet oledb:database Password=KYKY") Dim DT AsNew DataTable Dim cm AsNew OleDb.OleDbCommand Dim cari AsNew ByIskandar.CariKeDataBaseByIskandar
PrivateSub Latihan36_46109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load Dim nisa AsNew OleDb.OleDbDataAdapter nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '"& KB_46109050.Text &"'", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() nisa.Fill(DT) nisa.Dispose()
DGV_46109050.DataSource = DT
Dim dc(1) As DataColumn dc(0) = DT.Columns("kodebarang") DT.PrimaryKey = dc
EndSub
PrivateSub Button1_46109050_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_46109050.Click If KB_46109050.Text.Length = 0 Then MsgBox("kode barang belum terisi") ExitSub EndIf
If Val(UNT_46109050.Text) = 0 Then MsgBox("UNIT belum terisi") ExitSub EndIf
If Val(HRG_46109050.Text) = 0 Then MsgBox("HARGA belum terisi") ExitSub EndIf
Dim dr As DataRow dr = DT.Rows.Find(KB_46109050.Text) If dr IsNothingThen dr = DT.NewRow dr("KODEBARANG") = KB_46109050.Text dr("UNIT") = UNT_46109050.Text dr("HARGA") = HRG_46109050.Text
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain") EndIf
EndSub
PrivateSub Button2_46109050_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2_46109050.Click If NT_46109050.Text.Length = 0 Then MsgBox("no.transaksi belum terisi") ExitSub EndIf
If JT_46109050.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") ExitSub EndIf
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") ExitSub EndIf
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('"& NT_46109050.Text &"',#"& dtp_46109050.Value.Month &"/"& dtp_46109050.Value.Day &"/"& dtp_46109050.Value.Year &"#,'"& JT_46109050.Text &"')", CONECT) CONECT.Open() cm.ExecuteNonQuery() CONECT.Close()
ForEach x As DataRow In DT.Rows cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('"& NT_46109050.Text &"', '"& x("kodebarang") &"','"& x("unit") &"','"& x("harga") &"')", CONECT) CONECT.Open() cm.ExecuteNonQuery() CONECT.Close() Next cm.Dispose()
Public Class latihan_036_46109004 Dim yayu As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATAMAJEMUK.accdb") Dim tabel As New DataTable Dim ayu As DataRow
Private Sub latihan_036_46109004Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Y As New OleDb.OleDbDataAdapter Y = New OleDb.OleDbDataAdapter("Select KODEBARANG, UNIT, HARGA from DETAILTRANSAKSI WHERE NOTRANS= '" & a004.Text & "'", yayu) Y.Fill(tabel) Y.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = tabel.Columns("KODEBARANG") tabel.PrimaryKey = dataPrimary
dgv1.DataSource = tabel End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click 'a' If c004.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If Val(d004.Text) = 0 Then MsgBox("Masukkan Harga barang") Exit Sub End If
If Val(e004.Text) = 0 Then MsgBox("Masukkan jumlah barang") Exit Sub End If
'b' ayu = tabel.Rows.Find(c004.Text)
If ayu Is Nothing Then ayu = tabel.NewRow ayu("KODEBARANG") = c004.Text Else MsgBox("Maaf kode barang sudah ada") Exit Sub End If
Public Class Latihan36_46109038 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=yusri") Dim UCHYDT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan35_46109038_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ayus As New OleDb.OleDbDataAdapter ayus = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & Kobar_46109038.Text & "'", CONECT) UCHYDT.Rows.Clear() ayus.Fill(UCHYDT) DGV_46109038.DataSource = UCHYDT ayus.Dispose()
Dim kolom(1) As DataColumn kolom(0) = UCHYDT.Columns("NOTRANS") UCHYDT.PrimaryKey = kolom
End Sub
Private Sub Tambah_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah_46109038.Click If Kobar_46109038.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(Unit_46109038.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(Harga_46109038.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
cari.AturPencarianDataBase("DETAILTRANSAKSI", "KODEBARANG", Kobar_46109038.Text, 1, CONECT) If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
Private Sub Simpan_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109038.Click If NoTrans_46109038.Text.Length = 0 Then MsgBox("no.transaksi belum terisi") Exit Sub End If
If JenTrans_46109038.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If cari.AturPencarianDataBase("mastertransaksi", "notrans", NoTrans_46109038.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If UCHYDT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NoTrans_46109038.Text & "',#" & Tgl_46109038.Value.Date & "#," & Val(JenTrans_46109038.Text) & ")", CONECT)
Public Class LATIHAN036_46109020 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46") Dim TARI As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub LATIHAN036_46109020_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nisa As New OleDb.OleDbDataAdapter nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & KB46109020.Text & "'", CONECT) TARI.Rows.Clear() nisa.Fill(TARI) DGV46109020.DataSource = TARI
nisa.Dispose()
Dim mentarikolom(1) As DataColumn mentarikolom(0) = TARI.Columns("KODEBARANG") TARI.PrimaryKey = mentarikolom
End Sub
Private Sub TAMBAH46109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH46109020.Click If KB46109020.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(UN46109020.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(HR46109020.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB46109020.Text, 1, CONECT)
If pencari.JumlanBaris > 0 Then MsgBox("Kode tersebut telah ada, masukkan kode baru") Exit Sub End If
Private Sub SIMPAN46109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN46109020.Click If NT46109020.Text.Length = 0 Then MsgBox("no.transaksi belum terisi") Exit Sub End If
If JT46109020.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If TARI.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109020.Text & "',#" & DT46109020.Value.Date & "#," & Val(JT46109020.Text) & ")", CONECT)
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If t146109046.Text.Length = 0 Then MsgBox("Isi rong No Transaksi na..") Exit Sub End If
If t246109046.Text.Length = 0 Then MsgBox("Isi rong Jenis Transaksi na..") Exit Sub End If
If XX.Rows.Count = 0 Then MsgBox("Maaf...Isi rong itu datatable na..") Exit Sub End If
amhy.AturPencarianDataBase("mastertransaksi", "notrans", t146109046.Text, 1, CONECT) If amhy.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu") Exit Sub End If
For Each x As DataRow In XX.Rows YY = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & t146109046.Text & "', '" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", CONECT) CONECT.Open() YY.ExecuteNonQuery() CONECT.Close() Next YY.Dispose()
Komentar ini telah dihapus oleh pengarang.
BalasHapusKomentar ini telah dihapus oleh pengarang.
BalasHapusPublic Class Latihan036_46109015
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=015")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan036_46109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim imah As New OleDb.OleDbDataAdapter
imah = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & kb46109015.Text & "'", CONECT)
DT.Rows.Clear()
imah.Fill(DT)
dgv46109015.DataSource = DT
imah.Dispose()
Dim ima(1) As DataColumn
ima(0) = DT.Columns("NOTRANS")
DT.PrimaryKey = ima
End Sub
Private Sub t46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t46109015.Click
If kb46109015.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(u46109015.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
Dim drzany As DataRow
drzany = DT.NewRow
drzany("KODEBARANG") = kb46109015.Text
drzany("UNIT") = u46109015.Text
drzany("HARGA") = h46109015.Text
DT.Rows.Add(drzany)
kb46109015.Text = ""
u46109015.Text = ""
h46109015.Text = ""
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "KodeBarang", kb46109015.Text, 1, CONECT)
If pencari.JumlanBaris > 0 Then
MsgBox("Data yang anda masukkan telah ada")
Exit Sub
End If
End Sub
lanjutan...
BalasHapusPrivate Sub s46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s46109015.Click
If nt46109015.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If jt46109015.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt46109015.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109015.Text & "',#" & tgl46109015.Value.Date & "#," & Val(jt46109015.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & nt46109015.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
nt46109015.Text = ""
jt46109015.Text = ""
End Sub
End Class
Public Class TUGAS36
BalasHapusDim SRY As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DataMajemuk.accdb;Jet OLEDB:Database Password=11")
Dim REJEKI As New DataTable
Dim CARI As New ByIskandar.CariKeDataBaseByIskandar
Private Sub TUGAS36_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Q As New OleDb.OleDbDataAdapter
Q = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA from detailtransaksi where notrans = '" & T146109006.Text & "'", SRY)
Q.Fill(REJEKI)
Q.Dispose()
DGV46109006.DataSource = REJEKI
Dim KIKI(1) As DataColumn
KIKI(0) = REJEKI.Columns("NOTRANS")
REJEKI.PrimaryKey = KIKI
End Sub
Private Sub TOMBOL1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL1.Click
If KB.Text.Length = 0 Then
MsgBox("Kode Barang belum terisi")
Exit Sub
End If
If Val(UN.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(HR.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim KI2 As DataRow
KI2 = REJEKI.NewRow
KI2("KODEBARANG") = KB.Text
KI2("UNIT") = UN.Text
KI2("HARGA") = HR.Text
REJEKI.Rows.Add(KI2)
KB.Text = ""
UN.Text = ""
HR.Text = ""
End Sub
Private Sub TOMBOL2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL2.Click
If T146109006.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If T246109006.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
CARI.AturPencarianDataBase("mastertransaksi", "notrans", T146109006.Text, 1, SRY)
If CARI.JumlanBaris > 0 Then
MsgBox("NO.TRANSAKSI sudah ada")
Exit Sub
End If
If REJEKI.Rows.Count = 0 Then
MsgBox("Data tidak tersedia")
End If
Dim QI As New OleDb.OleDbCommand
QI = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & T146109006.Text & "',#" & DATE46109006.Value.Date & "#," & Val(T246109006.Text) & ")", SRY)
SRY.Open()
QI.ExecuteNonQuery()
SRY.Close()
For Each r As DataRow In REJEKI.Rows
QI = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & T146109006.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", SRY)
SRY.Open()
QI.ExecuteNonQuery()
SRY.Close()
QI.Dispose()
Next
REJEKI.Rows.Clear()
T146109006.Text = ""
T246109006.Text = ""
End Sub
End Class
Public Class Latihan3646109047
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=12345")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan3646109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim itha As New OleDb.OleDbDataAdapter
itha = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & kb46109047.Text & "'", CONECT)
DT.Rows.Clear()
itha.Fill(DT)
DataGridView1.DataSource = DT
itha.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb46109047.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(un46109047.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(hr46109047.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim muhitha As DataRow
muhitha = DT.NewRow
muhitha("KODEBARANG") = kb46109047.Text
muhitha("UNIT") = un46109047.Text
muhitha("HARGA") = hr46109047.Text
DT.Rows.Add(muhitha)
kb46109047.Text = ""
un46109047.Text = ""
hr46109047.Text = ""
End Sub
BalasHapusPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TB146109047.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If TB246109047.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", TB146109047.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TB146109047.Text & "',#" & DTP46109047.Value.Date & "#," & Val(TB246109047.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TB146109047.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
TB146109047.Text = ""
TB246109047.Text = ""
End Sub
End Class
andi novindra batari
BalasHapus3bd4
andi novindra batari
46109042
Public Class LATIHAN0360042
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=8")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If KB.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(UN.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(HR.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim drzany As DataRow
drzany = DT.NewRow
drzany("KODEBARANG") = KB.Text
drzany("UNIT") = UN.Text
drzany("HARGA") = HR.Text
DT.Rows.Add(drzany)
KB.Text = ""
UN.Text = ""
HR.Text = ""
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("barang", "kodebarang", kb.Text, 1, CONECT)
If pencari.JumlanBaris > 0 Then
MsgBox("data yang ada masukkan telah ada")
Exit Sub
End If
End Sub
Private Sub LATIHAN0360042_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim nisa As New OleDb.OleDbDataAdapter
nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & kb.Text & "'", CONECT)
DT.Rows.Clear()
nisa.Fill(DT)
DataGridView1.DataSource = DT
nisa.Dispose()
Dim novi(1) As DataColumn
novi(0) = DT.Columns("notrans")
DT.PrimaryKey = novi
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If TextBox2.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(TextBox2.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class
FARADILLAH AMALIA RIVAI
BalasHapusPublic Class LATIHAN036_46109010
Dim faradillah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46")
Dim fara As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN035_46109010_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rossi As New OleDb.OleDbDataAdapter
rossi = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & KB46109010.Text & "'", faradillah)
fara.Rows.Clear()
rossi.Fill(fara)
dgv46109010.DataSource = fara
rossi.Dispose()
Dim farah(1) As DataColumn
farah(0) = fara.Columns("KODEBARANG")
fara.PrimaryKey = farah
End Sub
Private Sub Button146109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109010.Click
If KB46109010.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(UN46109010.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(HR46109010.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim rivai As DataRow
rivai = fara.NewRow
rivai("KODEBARANG") = KB46109010.Text
rivai("UNIT") = UN46109010.Text
rivai("HARGA") = HR46109010.Text
fara.Rows.Add(rivai)
If rivai Is Nothing Then
rivai = fara.NewRow
rivai("KODEBARANG") = kb46109010.Text
Else
MsgBox("Maaf kode barang sudah ada")
Exit Sub
End If
KB46109010.Text = ""
UN46109010.Text = ""
HR46109010.Text = ""
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("Barang", "KodeBarang", kb46109010.Text, 1, faradillah)
If pencari.JumlanBaris > 0 Then
MsgBox("data yang anda masukkan telah ada")
Exit Sub
End If
End Sub
LANJUTAN LATIHAN 36 BY FARADILLAH AMALIA RIVAI
BalasHapusPrivate Sub Button24109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109010.Click
If nt46109010.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If jt46109010.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt46109010.Text, 1, faradillah)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If fara.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109010.Text & "',#" & dtp46109010.Value.Date & "#," & Val(jt46109010.Text) & ")", faradillah)
faradillah.Open()
com.ExecuteNonQuery()
faradillah.Close()
For Each r As DataRow In fara.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & nt46109010.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", faradillah)
faradillah.Open()
com.ExecuteNonQuery()
faradillah.Close()
com.Dispose()
Next
fara.Rows.Clear()
nt46109010.Text = ""
jt46109010.Text = ""
End Sub
End Class
PublicClass Latihan36_46109050
BalasHapusDim CONECT AsNew OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= "& Application.StartupPath &"\DATAMAJEMUK.accdb;jet oledb:database Password=KYKY")
Dim DT AsNew DataTable
Dim cm AsNew OleDb.OleDbCommand
Dim cari AsNew ByIskandar.CariKeDataBaseByIskandar
PrivateSub Latihan36_46109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Dim nisa AsNew OleDb.OleDbDataAdapter
nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '"& KB_46109050.Text &"'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear()
nisa.Fill(DT)
nisa.Dispose()
DGV_46109050.DataSource = DT
Dim dc(1) As DataColumn
dc(0) = DT.Columns("kodebarang")
DT.PrimaryKey = dc
EndSub
PrivateSub Button1_46109050_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_46109050.Click
If KB_46109050.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
ExitSub
EndIf
If Val(UNT_46109050.Text) = 0 Then
MsgBox("UNIT belum terisi")
ExitSub
EndIf
If Val(HRG_46109050.Text) = 0 Then
MsgBox("HARGA belum terisi")
ExitSub
EndIf
Dim dr As DataRow
dr = DT.Rows.Find(KB_46109050.Text)
If dr IsNothingThen
dr = DT.NewRow
dr("KODEBARANG") = KB_46109050.Text
dr("UNIT") = UNT_46109050.Text
dr("HARGA") = HRG_46109050.Text
DT.Rows.Add(dr)
KB_46109050.Text = ""
UNT_46109050.Text = ""
HRG_46109050.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
EndIf
EndSub
PrivateSub Button2_46109050_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2_46109050.Click
If NT_46109050.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
ExitSub
EndIf
If JT_46109050.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
ExitSub
EndIf
cari.AturPencarianDataBase("mastertransaksi", "notrans", NT_46109050.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
ExitSub
EndIf
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('"& NT_46109050.Text &"',#"& dtp_46109050.Value.Month &"/"& dtp_46109050.Value.Day &"/"& dtp_46109050.Value.Year &"#,'"& JT_46109050.Text &"')", CONECT)
CONECT.Open()
cm.ExecuteNonQuery()
CONECT.Close()
ForEach x As DataRow In DT.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('"& NT_46109050.Text &"', '"& x("kodebarang") &"','"& x("unit") &"','"& x("harga") &"')", CONECT)
CONECT.Open()
cm.ExecuteNonQuery()
CONECT.Close()
Next
cm.Dispose()
NT_46109050.Text = ""
JT_46109050.Text = ""
DT.Rows.Clear()
EndSub
EndClass
Public Class latihan_036_46109004
BalasHapusDim yayu As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATAMAJEMUK.accdb")
Dim tabel As New DataTable
Dim ayu As DataRow
Private Sub latihan_036_46109004Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Y As New OleDb.OleDbDataAdapter
Y = New OleDb.OleDbDataAdapter("Select KODEBARANG, UNIT, HARGA from DETAILTRANSAKSI WHERE NOTRANS= '" & a004.Text & "'", yayu)
Y.Fill(tabel)
Y.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = tabel.Columns("KODEBARANG")
tabel.PrimaryKey = dataPrimary
dgv1.DataSource = tabel
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
'a'
If c004.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If Val(d004.Text) = 0 Then
MsgBox("Masukkan Harga barang")
Exit Sub
End If
If Val(e004.Text) = 0 Then
MsgBox("Masukkan jumlah barang")
Exit Sub
End If
'b'
ayu = tabel.Rows.Find(c004.Text)
If ayu Is Nothing Then
ayu = tabel.NewRow
ayu("KODEBARANG") = c004.Text
Else
MsgBox("Maaf kode barang sudah ada")
Exit Sub
End If
'c'
ayu = tabel.NewRow
ayu("KODEBARANG") = c004.Text
ayu("UNIT") = d004.Text
ayu("HARGA") = e004.Text
tabel.Rows.Add(ayu)
'd'
c004.Text = ""
d004.Text = ""
e004.Text = ""
End Sub
Andi muh. Yusri
BalasHapusPublic Class Latihan36_46109038
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=yusri")
Dim UCHYDT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan35_46109038_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ayus As New OleDb.OleDbDataAdapter
ayus = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & Kobar_46109038.Text & "'", CONECT)
UCHYDT.Rows.Clear()
ayus.Fill(UCHYDT)
DGV_46109038.DataSource = UCHYDT
ayus.Dispose()
Dim kolom(1) As DataColumn
kolom(0) = UCHYDT.Columns("NOTRANS")
UCHYDT.PrimaryKey = kolom
End Sub
Private Sub Tambah_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah_46109038.Click
If Kobar_46109038.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(Unit_46109038.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(Harga_46109038.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("DETAILTRANSAKSI", "KODEBARANG", Kobar_46109038.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim kaka As DataRow
kaka = UCHYDT.NewRow
kaka("KODEBARANG") = Kobar_46109038.Text
kaka("UNIT") = Unit_46109038.Text
kaka("HARGA") = Harga_46109038.Text
UCHYDT.Rows.Add(kaka)
Kobar_46109038.Text = ""
Unit_46109038.Text = ""
Harga_46109038.Text = ""
End Sub
sambungan
BalasHapusAndi muh. yusri
Private Sub Simpan_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109038.Click
If NoTrans_46109038.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If JenTrans_46109038.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", NoTrans_46109038.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If UCHYDT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NoTrans_46109038.Text & "',#" & Tgl_46109038.Value.Date & "#," & Val(JenTrans_46109038.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each xyz As DataRow In UCHYDT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & NoTrans_46109038.Text & "','" & xyz("kodebarang") & "'," & xyz("unit") & "," & xyz("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
UCHYDT.Rows.Clear()
NoTrans_46109038.Text = ""
JenTrans_46109038.Text = ""
End Sub
End Class
Public Class LATIHAN036_46109020
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46")
Dim TARI As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN036_46109020_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim nisa As New OleDb.OleDbDataAdapter
nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & KB46109020.Text & "'", CONECT)
TARI.Rows.Clear()
nisa.Fill(TARI)
DGV46109020.DataSource = TARI
nisa.Dispose()
Dim mentarikolom(1) As DataColumn
mentarikolom(0) = TARI.Columns("KODEBARANG")
TARI.PrimaryKey = mentarikolom
End Sub
Private Sub TAMBAH46109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH46109020.Click
If KB46109020.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(UN46109020.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(HR46109020.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB46109020.Text, 1, CONECT)
If pencari.JumlanBaris > 0 Then
MsgBox("Kode tersebut telah ada, masukkan kode baru")
Exit Sub
End If
Dim hardiyanti As DataRow
hardiyanti = TARI.NewRow
hardiyanti("KODEBARANG") = KB46109020.Text
hardiyanti("UNIT") = UN46109020.Text
hardiyanti("HARGA") = HR46109020.Text
TARI.Rows.Add(hardiyanti)
KB46109020.Text = ""
UN46109020.Text = ""
HR46109020.Text = ""
End Sub
Lanjutannya.......
BalasHapusPrivate Sub SIMPAN46109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN46109020.Click
If NT46109020.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If JT46109020.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", NT46109020.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If TARI.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109020.Text & "',#" & DT46109020.Value.Date & "#," & Val(JT46109020.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In TARI.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & NT46109020.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TARI.Rows.Clear()
NT46109020.Text = ""
JT46109020.Text = ""
End Sub
End Class
Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BalasHapusIf t146109046.Text.Length = 0 Then
MsgBox("Isi rong No Transaksi na..")
Exit Sub
End If
If t246109046.Text.Length = 0 Then
MsgBox("Isi rong Jenis Transaksi na..")
Exit Sub
End If
If XX.Rows.Count = 0 Then
MsgBox("Maaf...Isi rong itu datatable na..")
Exit Sub
End If
amhy.AturPencarianDataBase("mastertransaksi", "notrans", t146109046.Text, 1, CONECT)
If amhy.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
YY = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & t146109046.Text & "',#" & DateTimePicker1.Value.Month & "/" & DateTimePicker1.Value.Day & "/" & DateTimePicker1.Value.Year & "#,'" & t246109046.Text & "')", CONECT)
CONECT.Open()
YY.ExecuteNonQuery()
CONECT.Close()
For Each x As DataRow In XX.Rows
YY = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & t146109046.Text & "', '" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", CONECT)
CONECT.Open()
YY.ExecuteNonQuery()
CONECT.Close()
Next
YY.Dispose()
t146109046.Text = ""
t246109046.Text = ""
XX.Rows.Clear()
End Sub
End Class