- TUGAS 32A
Public Class Form32A_36109015
Dim risa As New DataTable
Dim ahmad As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ridha()
Dim ak As New OleDb.OleDbDataAdapter
ak = New OleDb.OleDbDataAdapter("select * from barang", ahmad)
risa.Rows.Clear()
ak.Fill(risa)
ak.Dispose()
End Sub
Private Sub Form32A_36109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ridha()
DGV_36109015.DataSource = risa
End Sub
Private Sub TMBH_36109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TMBH_36109015.Click
If Form32B_36109015.Visible = False Then
Form32B_36109015.Show()
Else
Form32B_36109015.Activate()
End If
End Sub
Private Sub EDIT_36109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT_36109015.Click
If Form32C_36109015.Visible = False Then
Form32C_36109015.Show()
Else
Form32C_36109015.Activate()
End If
Form32C_36109015.t1_36109015.Text = DGV_36109015.CurrentRow.Cells("kodebarang").Value
Form32C_36109015.t2_36109015.Text = DGV_36109015.CurrentRow.Cells("namabarang").Value
Form32C_36109015.t3_36109015.Text = DGV_36109015.CurrentRow.Cells("hargajual").Value
Form32C_36109015.t4_36109015.Text = DGV_36109015.CurrentRow.Cells("jumlahbarang").Value
Form32C_36109015.KB_36109015.Text = DGV_36109015.CurrentRow.Cells("kodebarang").Value
Form32C_36109015.Show()
End Sub
End Class
- TUGAS 32B
Public Class Form32B_36109015
Dim risa As New ByIskandar.CariKeDataBaseByIskandar
Dim ridha As New OleDb.OleDbCommand
Dim ahmad As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan_36109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109015.Click
If t1_36109015.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109015.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109015.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109015.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
risa.AturPencarianDataBase("Barang", "KodeBarang", t1_36109015.Text, 1, ahmad)
If risa.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
ridha = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109015.Text & "','" & t2_36109015.Text & "'," & Val(t3_36109015.Text) & "," & Val(t4_36109015.Text) & ")", ahmad)
ahmad.Open()
ridha.ExecuteNonQuery()
ahmad.Close()
ridha.Dispose()
t1_36109015.Text = ""
t2_36109015.Text = ""
t3_36109015.Text = ""
t4_36109015.Text = ""
Form32A_36109015.ridha()
End Sub
End Class
- TUGAS 32C
Public Class Form32C_36109015
Dim risa As New ByIskandar.CariKeDataBaseByIskandar
Dim ridha As New OleDb.OleDbCommand
Dim ahmad As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan_36109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109015.Click
If t1_36109015.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109015.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109015.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109015.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t1_36109015.Text <> KB_36109015.Text Then
risa.AturPencarianDataBase("Barang", "KodeBarang", t1_36109015.Text, 1, ahmad)
If risa.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
ridha = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_36109015.Text & "', namabarang = '" & t2_36109015.Text & "', hargajual = " & Val(t3_36109015.Text) & ", jumlahbarang = " & Val(t4_36109015.Text) & " where kodebarang = '" & KB_36109015.Text & "'", ahmad)
ahmad.Open()
ridha.ExecuteNonQuery()
ahmad.Close()
ridha.Dispose()
t1_36109015.Text = ""
t2_36109015.Text = ""
t3_36109015.Text = ""
t4_36109015.Text = ""
KB_36109015.Text = ""
Form32A_36109015.ridha()
End Sub
End Class
A Monster Inside
8 tahun yang lalu

0 komentar:
Posting Komentar