Powered By Blogger

Jumat, 02 Desember 2011

Latihan 28

Public Class Latihan28B
Dim nini As New ByIskandar.CariKeDataBaseByIskandar
Dim rani As New OleDb.OleDbCommand
Dim nisa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")


Private Sub simpan_008_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_008.Click
If kb_008.Text.Length = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If

If nb_008.Text.Length = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If

If Val(hj_008.Text) = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If

If Val(jb_008.Text) = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If

nini.AturPencarianDataBase("Barang", "KodeBarang", kb_008.Text, 1, nisa)
If nini.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If

rani = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_008.Text & "','" & nb_008.Text & "'," & Val(hj_008.Text) & "," & Val(jb_008.Text) & ")", nisa)
nisa.Open()
rani.ExecuteNonQuery()
nisa.Close()
rani.Dispose()

kb_008.Text = ""
nb_008.Text = ""
hj_008.Text = ""
jb_008.Text = ""
End Sub

End Class

Jumat, 25 November 2011

Latihan 27

Public Class Latihan27
Dim nini As New ByIskandar.CariKeDataBaseByIskandar
Dim rani As New OleDb.OleDbCommand
Dim nisa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE ='" & Application.StartupPath & "\Databarang.ACCDB'")


Private Sub simpan_008_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_008.Click
If kb_008.Text.Length = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If

If nb_008.Text.Length = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If

If Val(hj_008.Text) = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If

If Val(jb_008.Text) = 0 Then
MsgBox("Isi dulue itu yang kosong")
Exit Sub
End If

nini.AturPencarianDataBase("Barang", "KodeBarang", kb_008.Text, 1, nisa)
If nini.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If

rani = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_008.Text & "','" & nb_008.Text & "'," & Val(hj_008.Text) & "," & Val(jb_008.Text) & ")", nisa)
nisa.Open()
rani.ExecuteNonQuery()
nisa.Close()
rani.Dispose()

kb_008.Text = ""
nb_008.Text = ""
hj_008.Text = ""
jb_008.Text = ""
End Sub


Private Sub Latihan27_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class

Kamis, 24 November 2011

Latihan 26

Latihan 26A

Public Class Latihan26A

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Private Sub Latihan26A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim np_36109008 As New OleDb.OleDbDataAdapter
np_36109008 = New OleDb.OleDbDataAdapter("select * From BARANG", NINI_36109008)
NINI_DT.Rows.Clear()
np_36109008.Fill(NINI_DT)
np_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT
End Sub

Private Sub button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_36109008.Click
If Latihan26B.Visible = False Then
Latihan26B.Show()
Else
Latihan26B.Activate()
End If

Latihan26B.KB_36109008.Text = DGV_36109008.CurrentRow.Cells("KODEBARANG").Value
Latihan26B.NB_36109008.Text = DGV_36109008.CurrentRow.Cells("NAMABARANG").Value
Latihan26B.HJ_36109008.Text = DGV_36109008.CurrentRow.Cells("HARGAJUAL").Value
Latihan26B.JB_36109008.Text = DGV_36109008.CurrentRow.Cells("PERSEDIAANAWAL").Value

Latihan26B.ANISA(Latihan26B.KB_36109008.Text)
End Sub
End Class

Latihan 26B

Public Class Latihan26B

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Public Sub ANISA(ByVal NISA As String)
Dim np1_36109008 As New OleDb.OleDbDataAdapter
np1_36109008 = New OleDb.OleDbDataAdapter("select MASTERTRANSAKSI.NOTRANS, MASTERTRANSAKSI.TANGGALTRANSAKSI, MASTERTRANSAKSI.JENISTRANSAKSI, MASTERTRANSAKSI.KETERANGAN, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, [DETAILTRANSAKSI]![UNIT]*[DETAILTRANSAKSI]![HARGA] AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN MASTERTRANSAKSI ON DETAILTRANSAKSI.NOTRANS = MASTERTRANSAKSI.NOTRANS WHERE KODEBARANG = '" & NISA & "'", NINI_36109008)
NINI_DT.Rows.Clear()
np1_36109008.Fill(NINI_DT)
np1_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT

Dim nini1_36109008 As Integer
Dim nini2_36109008 As Integer
For Each queen As DataRow In NINI_DT.Rows
nini1_36109008 = nini1_36109008 + queen("Unit")
nini2_36109008 = nini2_36109008 + queen("Jumlah")
Next
TU_36109008.Text = nini1_36109008
TJ_36109008.Text = nini2_36109008
End Sub

Private Sub Latihan26B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class

Latihan 25

Latihan 25A

Public Class Latihan25A

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Private Sub Latihan25A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim np_36109008 As New OleDb.OleDbDataAdapter
np_36109008 = New OleDb.OleDbDataAdapter("select * From BARANG", NINI_36109008)
NINI_DT.Rows.Clear()
np_36109008.Fill(NINI_DT)
np_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT
End Sub

Private Sub button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_36109008.Click
If Latihan25B.Visible = False Then
Latihan25B.Show()
Else
Latihan25B.Activate()
End If

Latihan25B.KB_36109008.Text = DGV_36109008.CurrentRow.Cells("KODEBARANG").Value
Latihan25B.NB_36109008.Text = DGV_36109008.CurrentRow.Cells("NAMABARANG").Value
Latihan25B.HJ_36109008.Text = DGV_36109008.CurrentRow.Cells("HARGAJUAL").Value
Latihan25B.JB_36109008.Text = DGV_36109008.CurrentRow.Cells("PERSEDIAANAWAL").Value

Latihan25B.ANISA(Latihan25B.KB_36109008.Text)
End Sub
End Class

Latihan 25B

Public Class Latihan25B

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Public Sub ANISA(ByVal NISA As String)
Dim np1_36109008 As New OleDb.OleDbDataAdapter
np1_36109008 = New OleDb.OleDbDataAdapter("select MASTERTRANSAKSI.NOTRANS, MASTERTRANSAKSI.TANGGALTRANSAKSI, MASTERTRANSAKSI.JENISTRANSAKSI, MASTERTRANSAKSI.KETERANGAN, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, [DETAILTRANSAKSI]![UNIT]*[DETAILTRANSAKSI]![HARGA] AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN MASTERTRANSAKSI ON DETAILTRANSAKSI.NOTRANS = MASTERTRANSAKSI.NOTRANS WHERE KODEBARANG = '" & NISA & "'", NINI_36109008)
NINI_DT.Rows.Clear()
np1_36109008.Fill(NINI_DT)
np1_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT
End Sub

Private Sub Latihan25B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class

Latihan 24

Latihan 24A

Public Class Latihan24A

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Private Sub Latihan24A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim np_36109008 As New OleDb.OleDbDataAdapter
np_36109008 = New OleDb.OleDbDataAdapter("select * From BARANG", NINI_36109008)
NINI_DT.Rows.Clear()
np_36109008.Fill(NINI_DT)
np_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT
End Sub
Private Sub button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_36109008.Click
If Latihan24B.Visible = False Then
Latihan24B.Show()
Else
Latihan24B.Activate()
End If

Latihan24B.KB_36109008.Text = DGV_36109008.CurrentRow.Cells("KODEBARANG").Value
Latihan24B.NB_36109008.Text = DGV_36109008.CurrentRow.Cells("NAMABARANG").Value
Latihan24B.HJ_36109008.Text = DGV_36109008.CurrentRow.Cells("HARGAJUAL").Value
Latihan24B.JB_36109008.Text = DGV_36109008.CurrentRow.Cells("PERSEDIAANAWAL").Value

Latihan24B.ANISA(Latihan24B.KB_36109008.Text)
End Sub
End Class

Latihan 24B

Public Class Latihan24B

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Public Sub ANISA(ByVal NISA As String)
Dim np1_36109008 As New OleDb.OleDbDataAdapter
np1_36109008 = New OleDb.OleDbDataAdapter("select * From DETAILTRANSAKSI Where KODEBARANG='" & NISA & "'", NINI_36109008)
NINI_DT.Rows.Clear()
np1_36109008.Fill(NINI_DT)
np1_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT
End Sub

Private Sub Latihan24B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class

Latihan 23

latihan 23A

Public Class Latihan23A
Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Private Sub KLIK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_36109008.Click
If Latihan23B.Visible = False Then
Latihan23B.Show()
Else
Latihan23B.Activate()
End If

Latihan23B.NO_36109008.Text = DGV_36109008.CurrentRow.Cells("NOTRANS").Value
Latihan23B.DTP_36109008.Value = DGV_36109008.CurrentRow.Cells("TANGGALTRANSAKSI").Value
Latihan23B.JNS_36109008.Text = DGV_36109008.CurrentRow.Cells("JENISTRANSAKSI").Value

Latihan23B.ANISA(Latihan23B.NO_36109008.Text)

End Sub

Private Sub Latihan23A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim np_36109008 As New OleDb.OleDbDataAdapter
np_36109008 = New OleDb.OleDbDataAdapter("select * From MASTERTRANSAKSI", NINI_36109008)
NINI_DT.Rows.Clear()
np_36109008.Fill(NINI_DT)
np_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT

End Sub
End Class

Latihan 23B

Public Class Latihan23B

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Public Sub ANISA(ByVal NISA As String)
Dim np1_36109008 As New OleDb.OleDbDataAdapter
np1_36109008 = New OleDb.OleDbDataAdapter("select * From DETAILTRANSAKSI Where NOTRANS='" & NISA & "'", NINI_36109008)
NINI_DT.Rows.Clear()
np1_36109008.Fill(NINI_DT)
np1_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT

End Sub

Private Sub Latihan23B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class

Jumat, 11 November 2011

latihan23A & B

Public Class Latihan23A
Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Private Sub KLIK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_36109008.Click
If Latihan23B.Visible = False Then
Latihan23B.Show()
Else
Latihan23B.Activate()
End If

Latihan23B.NO_36109008.Text = DGV_36109008.CurrentRow.Cells("NOTRANS").Value
Latihan23B.DTP_36109008.Value = DGV_36109008.CurrentRow.Cells("TANGGALTRANSAKSI").Value
Latihan23B.JNS_36109008.Text = DGV_36109008.CurrentRow.Cells("JENISTRANSAKSI").Value

Latihan23B.ANISA(Latihan23B.NO_36109008.Text)

End Sub

Private Sub Latihan23A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim np_36109008 As New OleDb.OleDbDataAdapter
np_36109008 = New OleDb.OleDbDataAdapter("select * From MASTERTRANSAKSI", NINI_36109008)
NINI_DT.Rows.Clear()
np_36109008.Fill(NINI_DT)
np_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT

End Sub
End Class

Latihan 23B

Public Class Latihan23B

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Public Sub ANISA(ByVal NISA As String)
Dim np1_36109008 As New OleDb.OleDbDataAdapter
np1_36109008 = New OleDb.OleDbDataAdapter("select * From DETAILTRANSAKSI Where NOTRANS='" & NISA & "'", NINI_36109008)
NINI_DT.Rows.Clear()
np1_36109008.Fill(NINI_DT)
np1_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT

End Sub

Private Sub Latihan23B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class