Public Class Latihan035_46109015 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 Latihan035_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() 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
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)
Public Class TUGAS35 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 TUGAS35_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 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 Latihan3546109047_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 & "',#" & DateTimePicker1.Value.Date & "#," & Val(TB246109047.Text) & ")", CONECT)
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 LATIHAN035012_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()
End Sub
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
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.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)
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 cari AsNew ByIskandar.CariKeDataBaseByIskandar
PrivateSub Latihan35_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) DataGridView1.DataSource = DT
nisa.Dispose()
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.Text) = 0 Then MsgBox("HARGA belum terisi") ExitSub EndIf
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
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") EndIf
Dim com AsNew OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('"& NT_46109050.Text &"',#"& DateTimePicker1.Value.Date &"#,"& Val(JT_46109050.Text) &")", CONECT)
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('"& NT_46109050.Text &"','"& r("kodebarang") &"',"& r("unit") &","& r("harga") &")", CONECT)
Dim Conect As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB: Database Password=allah swt") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN035012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim vero As New OleDb.OleDbDataAdapter vero = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & KB.Text & "'", Conect DT.Rows.Clear() vero.Fill(DT) DataGridView1.DataSource = DT
vero.Dispose()
End Sub
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
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If vd1_052.Text.Length = 0 Then MsgBox("no.transaksi belum terisi") Exit Sub
End If
If vd2_052.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub
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) value ('" & vd1_052.Text & "',# " & DateTimePicker1.Value.Date & "#," & Val(vd2_052.Text) & ")", Conect)
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 LATIHAN035012_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()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TMBH46109020.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
KB46109020.Text = "" UN46109020.Text = "" HR46109020.Text = "" End Sub
Private Sub SMPAN46109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SMPAN46109020.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 & "',#" & TGL46109020.Value.Date & "#," & Val(JT46109020.Text) & ")", CONECT)
Komentar ini telah dihapus oleh pengarang.
BalasHapusPublic Class Latihan035_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 Latihan035_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()
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 = ""
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
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 TUGAS35
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 TUGAS35_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
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 Latihan3546109047
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 Latihan3546109047_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
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.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 & "',#" & DateTimePicker1.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
BalasHapus3b-d4
Public Class LATIHAN035042
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 LATIHAN035012_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()
End Sub
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 = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.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
Komentar ini telah dihapus oleh pengarang.
BalasHapusPublicClass Latihan35_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 cari AsNew ByIskandar.CariKeDataBaseByIskandar
PrivateSub Latihan35_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)
DataGridView1.DataSource = DT
nisa.Dispose()
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.Text) = 0 Then
MsgBox("HARGA belum terisi")
ExitSub
EndIf
Dim drzany As DataRow
drzany = DT.NewRow
drzany("KODEBARANG") = KB_46109050.Text
drzany("UNIT") = UNT_46109050.Text
drzany("HARGA") = HRG.Text
DT.Rows.Add(drzany)
KB_46109050.Text = ""
UNT_46109050.Text = ""
HRG.Text = ""
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
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
EndIf
Dim com AsNew OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('"& NT_46109050.Text &"',#"& DateTimePicker1.Value.Date &"#,"& Val(JT_46109050.Text) &")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
ForEach r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('"& NT_46109050.Text &"','"& r("kodebarang") &"',"& r("unit") &","& r("harga") &")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
NT_46109050.Text = ""
JT_46109050.Text = ""
EndSub
EndClass
Public Class LATIHAN035012
BalasHapusDim Conect As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB: Database Password=allah swt")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN035012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim vero As New OleDb.OleDbDataAdapter
vero = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & KB.Text & "'", Conect
DT.Rows.Clear()
vero.Fill(DT)
DataGridView1.DataSource = DT
vero.Dispose()
End Sub
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
Dim nika As DataRow
nika = DT.NewRow
nika("KODEBARANG") = KB.Text
nika("UNIT") = UN.Text
nika("HARGA") = HR.Text
DT.Rows.Add(nika)
KB.Text = ""
UN.Text = ""
HR.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If vd1_052.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If vd2_052.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", vd1_052.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) value ('" & vd1_052.Text & "',# " & DateTimePicker1.Value.Date & "#," & Val(vd2_052.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 ('" & vd1_052.Text & "','" & r("kodebarang") & "'," & r("unit") & "'," & r("harga") & ")", Conect)
Conect.Open()
com.ExecuteNonQuery()
Conect.Close()
com.Dispose()
Next
DT.Rows.Clear()
vd1_052.Text = ""
vd2_052.Text = ""
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
End Sub
End Class
Public Class LATIHAN035_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 LATIHAN035012_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()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TMBH46109020.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 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
Private Sub SMPAN46109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SMPAN46109020.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 & "',#" & TGL46109020.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