Public Class tugas34a46109033
Private Sub DAFTARBARANGToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DAFTARBARANGToolStripMenuItem.Click
If tugas34b46109033.Visible = False Then
tugas34b46109033.MdiParent = Me.MdiParent
tugas34b46109033.Show()
Else
tugas34b46109033.Activate()
End If
End Sub
Private Sub INPUTBARANGToolStripMenuItem_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles INPUTBARANGToolStripMenuItem.Click
If tugas34c46109033.Visible = False Then
tugas34c46109033.MdiParent = Me.MdiParent
tugas34c46109033.Show()
Else
tugas34c46109033.Activate()
End If
End Sub
Private Sub ToolStripButton146109033_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStripButton146109033.Click
If tugas34b46109033.Visible = False Then
tugas34b46109033.MdiParent = Me.MdiParent
tugas34b46109033.Show()
Else
tugas34b46109033.Activate()
End If
End Sub
Private Sub ToolStripButton246109033_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ToolStripButton246109033.Click
If tugas34c46109033.Visible = False Then
tugas34c46109033.MdiParent = Me.MdiParent
tugas34c46109033.Show()
Else
tugas34c46109033.Activate()
End If
End Sub
End Class
Public Class tugas34b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim tm As New DataTable
Public Sub ambil()
Dim itik As New OleDb.OleDbDataAdapter
itik = New OleDb.OleDbDataAdapter("select * from barang", konek)
tm.Rows.Clear()
itik.Fill(tm)
itik.Dispose()
End Sub
Private Sub tugas34b46109033_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = tm
End Sub
Private Sub Button2461099033_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button246109033.Click
If tugas34c46109033.Visible = False Then
tugas34c46109033.Show()
Else
tugas34c46109033.Activate()
End If
End Sub
Private Sub Button146109033_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas34c46109033.Visible = False Then
tugas34c46109033.Show()
Else
tugas34c46109033.Activate()
End If
tugas34c46109033.KB.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas34c46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas34c46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("NAMABARANG").Value
tugas34c46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("HARGAJUAL").Value
tugas34c46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("JUMLAHBARANG").Value()
End Sub
End Class
Public Class tugas34c46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim tm As New ByIskandar.CariKeDataBaseByIskandar
Private Sub tambah()
If t146109033.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("JUMLAH BELUM TERISI")
Exit Sub
End If
tm.AturPencarianDataBase("barang", "kode barang", t146109033.Text, 1, konek)
If tm.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim go As New OleDb.OleDbCommand
go = New OleDb.OleDbCommand("insert into barang(kodebarang,namabarang,hargajual,jumlahbarang) Values('" & t146109033.Text & "','" & t246109033.Text & "'," & Val(t346109033.Text) & "," & Val(t446109033.Text) & ")", konek)
konek.Open()
go.ExecuteNonQuery()
konek.Close()
go.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
tugas33a46109033.ambil()
End Sub
Private Sub edit()
If t146109033.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("JUMLAH BELUM TERISI")
Exit Sub
End If
If KB.Text <> t146109033.Text Then
tm.AturPencarianDataBase("barang", "kode barang", t146109033.Text, 1, konek)
If tm.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
End If
Dim go As New OleDb.OleDbCommand
go = New OleDb.OleDbCommand("update barang set kodebarang ='" & t146109033.Text & "',namabarang='" & t246109033.Text & "',hargajual=" & Val(t346109033.Text) & ", jumlahbarang=" & Val(t446109033.Text) & "where kodebarang='" & KB.Text & "'", konek)
konek.Open()
go.ExecuteNonQuery()
konek.Close()
go.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
KB.Text = "-"
tugas33a46109033.ambil()
End Sub
Private Sub Button146109033_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If KB.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
End Class
TaufiqGooners
Sabtu, 19 November 2011
LATIHAN 33 APKOM
Public Class tugas33a46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim tm As New DataTable
Public Sub ambil()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("select * from barang", konek)
tm.Rows.Clear()
data.Fill(tm)
data.Dispose()
End Sub
Private Sub tugas33a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = tm
End Sub
Private Sub Button246109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109033.Click
If tugas33b46109033.Visible = False Then
tugas33b46109033.Show()
Else
tugas33b46109033.Activate()
End If
End Sub
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas33b46109033.Visible = False Then
tugas33b46109033.Show()
Else
tugas33b46109033.Activate()
End If
tugas33b46109033.KB.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas33b46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas33b46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("NAMABARANG").Value
tugas33b46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("HARGAJUAL").Value
tugas33b46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
Private Sub Button346109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button346109033.Click
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value & "'", konek)
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
ambil()
End Sub
End Class
Public Class tugas33b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If t146109033.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("jumlah barang")
Exit Sub
End If
itik.AturPencarianDataBase("barang", "kodebarang", t146109033.Text, 1, konek)
If itik.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into barang(kodebarang,namabarang,hargajual,jumlahbarang) Values('" & t146109033.Text & "','" & t246109033.Text & "'," & Val(t346109033.Text) & "," & Val(t446109033.Text) & ")", konek)
konek.Open()
com.ExecuteNonQuery()
konek.Close()
com.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Tugas33a46109033.ambil()
End Sub
End Class
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim tm As New DataTable
Public Sub ambil()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("select * from barang", konek)
tm.Rows.Clear()
data.Fill(tm)
data.Dispose()
End Sub
Private Sub tugas33a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = tm
End Sub
Private Sub Button246109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109033.Click
If tugas33b46109033.Visible = False Then
tugas33b46109033.Show()
Else
tugas33b46109033.Activate()
End If
End Sub
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas33b46109033.Visible = False Then
tugas33b46109033.Show()
Else
tugas33b46109033.Activate()
End If
tugas33b46109033.KB.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas33b46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas33b46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("NAMABARANG").Value
tugas33b46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("HARGAJUAL").Value
tugas33b46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
Private Sub Button346109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button346109033.Click
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("DELETE * FROM BARANG WHERE KODEBARANG='" & DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value & "'", konek)
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
ambil()
End Sub
End Class
Public Class tugas33b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If t146109033.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("jumlah barang")
Exit Sub
End If
itik.AturPencarianDataBase("barang", "kodebarang", t146109033.Text, 1, konek)
If itik.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into barang(kodebarang,namabarang,hargajual,jumlahbarang) Values('" & t146109033.Text & "','" & t246109033.Text & "'," & Val(t346109033.Text) & "," & Val(t446109033.Text) & ")", konek)
konek.Open()
com.ExecuteNonQuery()
konek.Close()
com.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Tugas33a46109033.ambil()
End Sub
End Class
LATIHAN 32 APKOM
Public Class tugas32a46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Private Sub tugas32a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tm As New OleDb.OleDbDataAdapter
tm = New OleDb.OleDbDataAdapter("select* from barang", konek)
tm.Fill(itik)
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas32c46109033.Visible = False Then
tugas32c46109033.Show()
Else
tugas32c46109033.Activate()
End If
tugas32c46109033.ToolStripStatusLabel1.Text = "kode barang lama= " & DataGridView146109033.CurrentRow.Cells("kodebarang").Value
tugas32c46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("kodebarang").Value
tugas32c46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("namabarang").Value
tugas32c46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("hargajual").Value
tugas32c46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("jumlahbarang").Value
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109033.Click
If tugas32b46109033.Visible = False Then
tugas32b46109033.Show()
Else
tugas32b46109033.Activate()
End If
End Sub
End Class
Public Class tugas32b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If Val(t146109033.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("psTambahBarang", konek)
itik.CommandType = CommandType.StoredProcedure
itik.Parameters.Add(New OleDb.OleDbParameter("pKodeBarang", t146109033.Text))
itik.Parameters.Add(New OleDb.OleDbParameter("pNamaBarang", t246109033.Text))
itik.Parameters.Add(New OleDb.OleDbParameter("pPersawal", Val(t346109033.Text)))
itik.Parameters.Add(New OleDb.OleDbParameter("pHargajual", Val(t446109033.Text)))
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
Public Class tugas32c46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If Val(t146109033.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("UPDATE BARANG SET kodebarang = '" & t146109033.Text & "', namabarang = '" & t246109033.Text & "', hargajual = " & Val(t346109033.Text) & ", jumlahbarang = " & Val(t446109033.Text) & " where kodebarang ='" & ToolStripStatusLabel1.Text & "'", konek)
konek.Open()
com.ExecuteNonQuery()
konek.Close()
com.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Private Sub tugas32a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tm As New OleDb.OleDbDataAdapter
tm = New OleDb.OleDbDataAdapter("select* from barang", konek)
tm.Fill(itik)
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas32c46109033.Visible = False Then
tugas32c46109033.Show()
Else
tugas32c46109033.Activate()
End If
tugas32c46109033.ToolStripStatusLabel1.Text = "kode barang lama= " & DataGridView146109033.CurrentRow.Cells("kodebarang").Value
tugas32c46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("kodebarang").Value
tugas32c46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("namabarang").Value
tugas32c46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("hargajual").Value
tugas32c46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("jumlahbarang").Value
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109033.Click
If tugas32b46109033.Visible = False Then
tugas32b46109033.Show()
Else
tugas32b46109033.Activate()
End If
End Sub
End Class
Public Class tugas32b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If Val(t146109033.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("psTambahBarang", konek)
itik.CommandType = CommandType.StoredProcedure
itik.Parameters.Add(New OleDb.OleDbParameter("pKodeBarang", t146109033.Text))
itik.Parameters.Add(New OleDb.OleDbParameter("pNamaBarang", t246109033.Text))
itik.Parameters.Add(New OleDb.OleDbParameter("pPersawal", Val(t346109033.Text)))
itik.Parameters.Add(New OleDb.OleDbParameter("pHargajual", Val(t446109033.Text)))
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
Public Class tugas32c46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If Val(t146109033.Text) = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("nama barang belum terisi")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("harga jual belum diisi")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("jumlah barang belum diisi")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("UPDATE BARANG SET kodebarang = '" & t146109033.Text & "', namabarang = '" & t246109033.Text & "', hargajual = " & Val(t346109033.Text) & ", jumlahbarang = " & Val(t446109033.Text) & " where kodebarang ='" & ToolStripStatusLabel1.Text & "'", konek)
konek.Open()
com.ExecuteNonQuery()
konek.Close()
com.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
LATIHAN 31 APKOM
Public Class tugas31a46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Public Sub ambil()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM barang", konek)
itik.Rows.Clear()
data.Fill(itik)
data.Dispose()
End Sub
Private Sub tugas31a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click, Button146109033.Click
If tugas31b46109033.Visible = False Then
tugas31b46109033.Show()
Else
tugas31b46109033.Activate()
End If
tugas31b46109033.KB.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas31b46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas31b46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("NAMABARANG").Value
tugas31b46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("HARGAJUAL").Value
tugas31b46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
End Class
Public Class tugas31b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If t146109033.Text.Length = 0 Then
MsgBox("Please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("Please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("Please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("Please insert your text")
Exit Sub
End If
If KB.Text <> t146109033.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & t146109033.Text & "', NAMABARANG = '" & t246109033.Text & "', HARGAJUAL=" & Val(t346109033.Text) & ", JUMLAHBARANG=" & Val(t446109033.Text) & " where KODEBARANG='" & KB.Text & "'", konek)
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
KB.Text = ""
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
tugas31a46109033.ambil()
Me.Close()
End Sub
End Class
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Public Sub ambil()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM barang", konek)
itik.Rows.Clear()
data.Fill(itik)
data.Dispose()
End Sub
Private Sub tugas31a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click, Button146109033.Click
If tugas31b46109033.Visible = False Then
tugas31b46109033.Show()
Else
tugas31b46109033.Activate()
End If
tugas31b46109033.KB.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas31b46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas31b46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("NAMABARANG").Value
tugas31b46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("HARGAJUAL").Value
tugas31b46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
End Class
Public Class tugas31b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If t146109033.Text.Length = 0 Then
MsgBox("Please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("Please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("Please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("Please insert your text")
Exit Sub
End If
If KB.Text <> t146109033.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & t146109033.Text & "', NAMABARANG = '" & t246109033.Text & "', HARGAJUAL=" & Val(t346109033.Text) & ", JUMLAHBARANG=" & Val(t446109033.Text) & " where KODEBARANG='" & KB.Text & "'", konek)
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
KB.Text = ""
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
tugas31a46109033.ambil()
Me.Close()
End Sub
End Class
LATIHAN 30 APKOM
Public Class tugas30a46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Public Sub ambil()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM BARANG", konek)
itik.Rows.Clear()
data.Fill(itik)
data.Dispose()
End Sub
Private Sub tugas30a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button146109033_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas30b46109033.Visible = False Then
tugas30b46109033.Show()
Else
tugas30b46109033.Activate()
End If
tugas30b46109033.kb46109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas30b46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas30b46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("NAMABARANG").Value
tugas30b46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("HARGAJUAL").Value
tugas30b46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
End Class
Public Class tugas30b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If t146109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If kb46109033.Text <> t146109033.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & t146109033.Text & "', NAMABARANG = '" & t246109033.Text & "', HARGAJUAL=" & Val(t346109033.Text) & ", JUMLAHBARANG=" & Val(t446109033.Text) & " where KODEBARANG='" & kb46109033.Text & "'", konek)
konek.Open()
itik.Dispose()
kb46109033.Text = ""
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
tugas30a46109033.ambil()
Me.Close()
End Sub
End Class
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Public Sub ambil()
Dim data As New OleDb.OleDbDataAdapter
data = New OleDb.OleDbDataAdapter("SELECT* FROM BARANG", konek)
itik.Rows.Clear()
data.Fill(itik)
data.Dispose()
End Sub
Private Sub tugas30a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button146109033_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas30b46109033.Visible = False Then
tugas30b46109033.Show()
Else
tugas30b46109033.Activate()
End If
tugas30b46109033.kb46109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas30b46109033.t146109033.Text = DataGridView146109033.CurrentRow.Cells("KODEBARANG").Value
tugas30b46109033.t246109033.Text = DataGridView146109033.CurrentRow.Cells("NAMABARANG").Value
tugas30b46109033.t346109033.Text = DataGridView146109033.CurrentRow.Cells("HARGAJUAL").Value
tugas30b46109033.t446109033.Text = DataGridView146109033.CurrentRow.Cells("JUMLAHBARANG").Value
End Sub
End Class
Public Class tugas30b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If t146109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If kb46109033.Text <> t146109033.Text Then
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & t146109033.Text & "', NAMABARANG = '" & t246109033.Text & "', HARGAJUAL=" & Val(t346109033.Text) & ", JUMLAHBARANG=" & Val(t446109033.Text) & " where KODEBARANG='" & kb46109033.Text & "'", konek)
konek.Open()
itik.Dispose()
kb46109033.Text = ""
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
tugas30a46109033.ambil()
Me.Close()
End Sub
End Class
LATIHAN 29 APKOM
Public Class tugas2946109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If kb46109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t146109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
kb46109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
Dim taufiq As New OleDb.OleDbCommand
taufiq = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & t146109033.Text & "' , NAMABARANG = '" & t246109033.Text & "' , HARGAJUAL=" & Val(t346109033.Text) & ", JUMLAHBARANG =" & Val(t446109033.Text) & " where KODEBARANG ='" & kb46109033.Text & "'", konek)
konek.Open()
taufiq.ExecuteNonQuery()
konek.Close()
taufiq.Dispose()
kb46109033.Text = ""
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If kb46109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t146109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
kb46109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
Dim taufiq As New OleDb.OleDbCommand
taufiq = New OleDb.OleDbCommand("update BARANG set KODEBARANG ='" & t146109033.Text & "' , NAMABARANG = '" & t246109033.Text & "' , HARGAJUAL=" & Val(t346109033.Text) & ", JUMLAHBARANG =" & Val(t446109033.Text) & " where KODEBARANG ='" & kb46109033.Text & "'", konek)
konek.Open()
taufiq.ExecuteNonQuery()
konek.Close()
taufiq.Dispose()
kb46109033.Text = ""
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
End Sub
End Class
LATIHAN 28 APKOM
Public Class tugas28a46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Public Sub ambil()
Dim tm As New OleDb.OleDbDataAdapter
tm = New OleDb.OleDbDataAdapter("SELECT*from BARANG", konek)
itik.Rows.Clear()
tm.Fill(itik)
tm.Dispose()
End Sub
Private Sub tugas28a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas28b46109033.Visible = False Then
tugas28b46109033.Show()
Else
tugas28b46109033.Activate()
End If
End Sub
Private Sub Button246109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109033.Click
Me.Close()
End Sub
End Class
Public Class tugas28b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If t146109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("INSERT INTO BARANG(KODEBARANG,NAMABARANG,HARGAJUAL,JUMLAHBARANG)VALUES ('" & t146109033.Text & "','" & t246109033.Text & "'," & Val(t346109033.Text) & "," & Val(t446109033.Text) & " )", konek)
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
tugas28a46109033.ambil()
Me.Close()
End Sub
End Class
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Dim itik As New DataTable
Public Sub ambil()
Dim tm As New OleDb.OleDbDataAdapter
tm = New OleDb.OleDbDataAdapter("SELECT*from BARANG", konek)
itik.Rows.Clear()
tm.Fill(itik)
tm.Dispose()
End Sub
Private Sub tugas28a46109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ambil()
DataGridView146109033.DataSource = itik
End Sub
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If tugas28b46109033.Visible = False Then
tugas28b46109033.Show()
Else
tugas28b46109033.Activate()
End If
End Sub
Private Sub Button246109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109033.Click
Me.Close()
End Sub
End Class
Public Class tugas28b46109033
Dim konek As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\databarang.accdb;jet OLEDB:database password=2121990")
Private Sub Button146109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109033.Click
If t146109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If t246109033.Text.Length = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t346109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
If Val(t446109033.Text) = 0 Then
MsgBox("please insert your text")
Exit Sub
End If
Dim PENCARI As New ByIskandar.CariKeDataBaseByIskandar
PENCARI.AturPencarianDataBase("BARANG", "KODEBARANG", t146109033.Text, 1, konek)
If PENCARI.JumlanBaris > 0 Then
MsgBox("the data has been exist please insert new data")
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
Exit Sub
End If
Dim itik As New OleDb.OleDbCommand
itik = New OleDb.OleDbCommand("INSERT INTO BARANG(KODEBARANG,NAMABARANG,HARGAJUAL,JUMLAHBARANG)VALUES ('" & t146109033.Text & "','" & t246109033.Text & "'," & Val(t346109033.Text) & "," & Val(t446109033.Text) & " )", konek)
konek.Open()
itik.ExecuteNonQuery()
konek.Close()
itik.Dispose()
t146109033.Text = ""
t246109033.Text = ""
t346109033.Text = ""
t446109033.Text = ""
tugas28a46109033.ambil()
Me.Close()
End Sub
End Class
Langganan:
Komentar (Atom)