- TUGAS 31A
Public Class Form31A_36109015
Dim ridha As New DataTable
Dim ahmad As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub risa()
Dim ak As New OleDb.OleDbDataAdapter
ak = New OleDb.OleDbDataAdapter("select * from barang", ahmad)
ridha.Rows.Clear()
ak.Fill(ridha)
ak.Dispose()
End Sub
Private Sub Form31A_36109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
risa()
dgv_36109015.DataSource = ridha
End Sub
Private Sub edit_36109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit_36109015.Click
If Form31B_36109015.Visible = False Then
Form31B_36109015.Show()
Else
Form31B_36109015.Activate()
End If
Form31B_36109015.t1_36109015.Text = dgv_36109015.CurrentRow.Cells("kodebarang").Value
Form31B_36109015.t2_36109015.Text = dgv_36109015.CurrentRow.Cells("namabarang").Value
Form31B_36109015.t3_36109015.Text = dgv_36109015.CurrentRow.Cells("hargajual").Value
Form31B_36109015.t4_36109015.Text = dgv_36109015.CurrentRow.Cells("jumlahbarang").Value
Form31B_36109015.KB_36109015.Text = dgv_36109015.CurrentRow.Cells("kodebarang").Value
Form31B_36109015.Show()
End Sub
End Class
- TUGAS 31B
Public Class Form31B_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 Button1_36109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_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 <> t2_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 = "-"
Form31A_36109015.risa()
End Sub
End Class
A Monster Inside
8 tahun yang lalu

0 komentar:
Posting Komentar