Public Class Form27
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
Dim search As New ByIskandar.CariKeDataBaseByIskandar
search.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If search.JumlanBaris > 0 Then
MsgBox("kode barang sudah ada")
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Exit Sub
End If
Dim cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", irma)
irma.Open()
cm.ExecuteNonQuery()
irma.Close()
cm.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Public Class Form28A
Dim ar As New DataTable
Dim nurul As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ami()
Dim am As New OleDb.OleDbDataAdapter
am = New OleDb.OleDbDataAdapter("select * from barang", nurul)
ar.Rows.Clear()
am.Fill(ar)
am.Dispose()
End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ami()
dgv_021.DataSource = ar
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
If Form28B.Visible = False Then
Form28B.Show()
Else
Form28B.Activate()
End If
End Sub
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
Close()
End Sub
End Class
Public Class Form28B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
Dim search As New ByIskandar.CariKeDataBaseByIskandar
search.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If search.JumlanBaris > 0 Then
MsgBox("Data sudah dimasukkan")
Exit Sub
End If
Dim cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", irma)
irma.Open()
cm.ExecuteNonQuery()
irma.Close()
cm.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Public Class Form29
Dim ar As New OleDb.OleDbCommand
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
ts4_021.Text = ""
End Sub
End Class
Public Class Form30A
Dim ar As New DataTable
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ami()
Dim mee As New OleDb.OleDbDataAdapter
mee = New OleDb.OleDbDataAdapter("select * from barang", irma)
ar.Rows.Clear()
mee.Fill(ar)
mee.Dispose()
End Sub
Private Sub Form30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ami()
dgv_021.DataSource = ar
End Sub
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If Form30B.Visible = False Then
Form30B.Show()
Else
Form30B.Activate()
End If
Form30B.kb_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form30B.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form30B.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form30B.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form30B.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
Form30B.Show()
End Sub
End Class
Public Class Form30B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim ar As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Form30A.ami()
End Sub
End Class
Public Class Form30B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim ar As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Form30A.ami()
End Sub
End Class
Public Class Form31B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If KB.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("kode barang tidak dapat diupdate")
Exit Sub
End If
End If
If t1_021.Text.Length = 0 Then
MsgBox("kode barang harus tercantum")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("nama barang harus tercantum")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("harga jual harus tercantum")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("jumlah barang harus tercantum")
Exit Sub
End If
Dim ara As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
nurul = New OleDb.OleDbCommand(ara, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
KB.Text = "-"
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Tidak ada komentar:
Posting Komentar