Aplikasi untuk penjualan handphone
#Analisa kebutuhan
- aplikasi ini berfungsi untuk para penjual hp agar dapet lebih mudah memasarkan dagangannya
- menyimpan dan mencari stok2 hp dari penjual
Tampilan menu utama dan table simpan
Coding
Imports System.Data
Imports System.Data.OleDb
Public Class formhp
Inherits System.Web.UI.Page
Dim koneksi As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Khairul Rizky R\Documents\handphone.mdb"
Dim objekKoneksi As New OleDb.OleDbConnection(koneksi)
Dim xReader As OleDb.OleDbDataReader
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
Protected Sub save_Click(sender As Object, e As EventArgs) Handles save.Click
objekKoneksi.Open()
Dim tambah As String = "INSERT INTO T_barang values ('" & khp.Text & "','" & mhp.Text & "','" & thp.Text & "','" & hhp.Text & "')"
Dim objCmd = New OleDbCommand(tambah, objekKoneksi)
objCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("DATA BERHASIL DISIMPAN")
End Sub
Protected Sub view_Click(sender As Object, e As EventArgs) Handles view.Click
Response.Redirect("tablehp.aspx")
End Sub
Protected Sub entry_Click(sender As Object, e As EventArgs) Handles entry.Click
khp.Text = ""
mhp.Text = ""
thp.Text = ""
hhp.Text = ""
End Sub
Protected Sub cari_Click(sender As Object, e As EventArgs) Handles cari.Click
If Not Len(chp.Text) = 0 Then
objekKoneksi.Close()
objekKoneksi.Open()
Dim ocmd As New OleDb.OleDbCommand(" SELECT * FROM T_barang where KODE_HP='" + chp.Text + "'", objekKoneksi)
xReader = ocmd.ExecuteReader()
If xReader.HasRows Then
xReader.Read()
khp.Text = xReader("KODE_HP")
mhp.Text = xReader("MERK_HP")
thp.Text = xReader("TYPE_HP")
hhp.Text = xReader("HARGA")
Else
chp.Text = "hp tidak ada"
Exit Sub
End If
End If
End Sub
Protected Sub transsaksi_Click(sender As Object, e As EventArgs) Handles transsaksi.Click
Response.Redirect("transaksi.aspx")
End Sub
End Class
Menu transaksi
Coding
Imports System.Data.OleDb
Public Class transaksi
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Khairul Rizky R\Documents\handphone.mdb"
Dim objekkoneksi As New OleDb.OleDbConnection(koneksi)
End Sub
Protected Sub hitung_Click(sender As Object, e As EventArgs) Handles hitung.Click
Dim bil1, bil2, hasil As Integer
bil1 = hhp.Text
bil2 = qhp.Text
hasil = hhp.Text * qhp.Text
tohp.Text = hasil
End Sub
Protected Sub simpan_Click(sender As Object, e As EventArgs) Handles simpan.Click
objekKoneksi.Open()
Dim tambah As String = "INSERT INTO T_barang values ('" & khp.Text & "','" & mhp.Text & "','" & thp.Text & "','" & hhp.Text & "')"
Dim objCmd = New OleDbCommand(tambah, objekKoneksi)
objCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("DATA BERHASIL DISIMPAN")
End Sub
Protected Sub menuutama_Click(sender As Object, e As EventArgs) Handles menuutama.Click
Response.Redirect("formhp.aspx")
End Sub
Protected Sub entry_Click(sender As Object, e As EventArgs) Handles entry.Click
khp.Text = ""
mhp.Text = ""
thp.Text = ""
hhp.Text = ""
qhp.Text = ""
tohp.Text = ""
End Sub
Private Function objekKoneksi() As Object
Throw New NotImplementedException
End Function
End Class