Form1
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Pembelian.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Penjualan.Show()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Persediaan.Show()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Querry1.Show()
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class
Pembelian
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class Pembelian
Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=F:\riyan\Beli-Beli HP.accdb"
Dim ObjekKoneksi As New OleDb.OleDbConnection(Koneksi)
Dim xReader As OleDbDataReader
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox7.Text = TextBox5.Text * TextBox4.Text
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Data_Pembelian.Show()
End
Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox1.Focus()
ObjekKoneksi.Close()
ObjekKoneksi.Open()
Dim TambahDataPembelian As String = "INSERT INTO
TablePembelian VALUES('" & TextBox1.Text & "','" & TextBox3.Text & "', '" & TextBox2.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "')"
Dim Ocmd = New OleDbCommand(TambahDataPembelian,
ObjekKoneksi)
Ocmd.ExecuteNonQuery()
ObjekKoneksi.Close()
MsgBox("Sukses")
End Sub
Private Sub Pembelian_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class
Penjualan
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class penjualan
Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data
Source=F:\riyan\Beli-Beli HP.accdb"
Dim ObjekKoneksi As New OleDb.OleDbConnection(Koneksi)
Dim xReader As OleDbDataReader
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox7.Text = TextBox4.Text * TextBox5.Text
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Data_Penjualan.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox1.Focus()
ObjekKoneksi.Close()
ObjekKoneksi.Open()
Dim TambahDataPembelian As String = "INSERT INTO
TablePembelian VALUES('" & TextBox1.Text & "','" & TextBox3.Text & "', '" & TextBox2.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "','" & TextBox6.Text & "')"
Dim Ocmd = New OleDbCommand(TambahDataPembelian,
ObjekKoneksi)
Ocmd.ExecuteNonQuery()
ObjekKoneksi.Close()
MsgBox("Sukses")
End Sub
Private Sub penjualan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class
Persediaan
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OleDb
Public Class Persediaan
Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\riyan\Beli-Beli HP.accdb"
Dim ObjekKoneksi As New OleDb.OleDbConnection(Koneksi)
Dim xReader As OleDbDataReader
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
Data_Persediaan.Show()
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
MessageBox.Show("Apakah Anda Yakin?", "caption", MessageBoxButtons.YesNo)
If DialogResult.Yes Then
Dim sql As String = "Delete FROM TablePersediaan WHERE NamaBarang='" + TextBox2.Text + "' where KodeBarang='" + TextBox1.Text + "'"
Dim oCmd As New OleDbCommand
ObjekKoneksi.Close()
ObjekKoneksi.Open()
oCmd.Connection = ObjekKoneksi
oCmd.CommandText = sql
oCmd.ExecuteNonQuery()
MsgBox("Sukses")
Else
Exit Sub
End If
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Dim sql As String = "Update TablePersediaan set NamaBarang='" + TextBox2.Text + "' where KodeBarang='" + TextBox1.Text + "'"
Dim oCmd As New OleDbCommand
ObjekKoneksi.Close()
ObjekKoneksi.Open()
oCmd.Connection = ObjekKoneksi
oCmd.CommandText = sql
oCmd.ExecuteNonQuery()
MsgBox("Sukses")
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim VKodeMK = InputBox("Masukan Kode Mata Kuliah")
ObjekKoneksi.Close()
ObjekKoneksi.Open()
Dim Ocmd As New OleDbCommand("SELECT * FROM TableMK Where KodeMK='" + VKodeMK + "'", ObjekKoneksi)
xReader = Ocmd.ExecuteReader
If xReader.HasRows Then
xReader.Read()
TextBox1.Text = xReader("KodeBarang")
TextBox2.Text = xReader("NamaBarang")
TextBox3.Text = xReader("JumlahBarang")
Else
MsgBox("Kode Mata Kuliah Tidak Ada")
Exit Sub
End If
xReader.Close()
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
PRINT.Show()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox1.Focus()
ObjekKoneksi.Close()
ObjekKoneksi.Open()
Dim TambahDataPenjualan As String = "INSERT INTO TablePembelian VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "', '" & TextBox3.Text & "')"
Dim Ocmd = New OleDbCommand(TambahDataPenjualan, ObjekKoneksi)
Ocmd.ExecuteNonQuery()
ObjekKoneksi.Close()
MsgBox("Sukses")
End Sub
Private Sub Persediaan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
End Class
Querry1