Aplikasi Pembayaran Laptop
Assalamu'alaikum Wr. Wb.
Pada kesempatan kali ini, saya telah membuat project berbasis Web dengan menggunakan Visual Studio yang terintegrasi dengan Microsoft Access sebagai databasenya. Aplikasi ini dibuat untuk memudahkan pembayaran laptop dan melihat spesifikasi laptop seperti Processor, VGA, HDD, SSD, dan Sistem Operasi yang digunakan laptop tersebut.
Komponen yang dibutuhkan:
Tampilan di Visual Studio
Tampilan di Microsoft Access
Tampilan setelah berhasil disimpan
Tampilan database
Tampilan setelah berhasil dirubah
Tampilan setelahnya
Source Code:
Imports System.Data
Imports System.Data.OleDb
Public Class WebFormLaptop
Inherits System.Web.UI.Page
Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ASUS\Documents\UAS.accdb"
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
Button Simpan
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
objekKoneksi.Open()
Dim tambah As String = "INSERT INTO TableLaptop values('" & TextMerek.Text & "','" & TextPro.Text & "','" & TextVGA.Text & "','" & TextHDD.Text & "','" & TextSSD.Text & "','" & TextRAM.Text & "','" & TextOS.Text & "','" & TextHarga.Text & "') "
Dim oCmd = New OleDbCommand(tambah, objekKoneksi)
oCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("Berhasil disimpan")
End Sub
Button Cari
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If Not Len(TextMerek.Text) = 0 Then
objekKoneksi.Close()
objekKoneksi.Open()
Dim oCmd As New OleDb.OleDbCommand("SELECT * FROM TableLaptop where MEREK='" + TextMerek.Text + "'", objekKoneksi)
Xreader = oCmd.ExecuteReader()
If Xreader.HasRows Then
Xreader.Read()
TextMerek.Text = Xreader("MEREK")
TextPro.Text = Xreader("PROCESSOR")
TextVGA.Text = Xreader("VGA")
TextHDD.Text = Xreader("HDD")
TextSSD.Text = Xreader("SSD")
TextRAM.Text = Xreader("RAM")
TextOS.Text = Xreader("OS")
TextHarga.Text = Xreader("HARGA")
Button4.Enabled = True
Button5.Enabled = True
Else
TextMerek.Text = "Tidak ada"
Exit Sub
End If
Xreader.Close()
End If
End Sub
Button View
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Response.Redirect("WebFormView.aspx")
End Sub
Button Update
Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
objekKoneksi.Open()
Dim Update As String = "UPDATE TableLaptop set HARGA='" + TextHarga.Text + "' where MEREK='" + Trim(TextMerek.Text) + "'"
Dim oCmd = New OleDbCommand(Update, objekKoneksi)
oCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("Berhasil dirubah")
End Sub
Button Hapus
Protected Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
objekKoneksi.Open()
Dim oCmd As New OleDb.OleDbCommand("DELETE * FROM TableLaptop where MEREK='" + TextMerek.Text + "'", objekKoneksi)
oCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("Berhasil dihapus")
End Sub
End Class
Wassalamu'alaikum Wr. Wb.
Pada kesempatan kali ini, saya telah membuat project berbasis Web dengan menggunakan Visual Studio yang terintegrasi dengan Microsoft Access sebagai databasenya. Aplikasi ini dibuat untuk memudahkan pembayaran laptop dan melihat spesifikasi laptop seperti Processor, VGA, HDD, SSD, dan Sistem Operasi yang digunakan laptop tersebut.
Komponen yang dibutuhkan:
- Label
- TextBox
- Button
Tampilan di Visual Studio
Tampilan di Microsoft Access
Tampilan setelah berhasil disimpan
Tampilan database
Tampilan setelah berhasil dirubah
Tampilan setelahnya
Source Code:
Imports System.Data
Imports System.Data.OleDb
Public Class WebFormLaptop
Inherits System.Web.UI.Page
Dim Koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\ASUS\Documents\UAS.accdb"
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
Button Simpan
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
objekKoneksi.Open()
Dim tambah As String = "INSERT INTO TableLaptop values('" & TextMerek.Text & "','" & TextPro.Text & "','" & TextVGA.Text & "','" & TextHDD.Text & "','" & TextSSD.Text & "','" & TextRAM.Text & "','" & TextOS.Text & "','" & TextHarga.Text & "') "
Dim oCmd = New OleDbCommand(tambah, objekKoneksi)
oCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("Berhasil disimpan")
End Sub
Button Cari
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If Not Len(TextMerek.Text) = 0 Then
objekKoneksi.Close()
objekKoneksi.Open()
Dim oCmd As New OleDb.OleDbCommand("SELECT * FROM TableLaptop where MEREK='" + TextMerek.Text + "'", objekKoneksi)
Xreader = oCmd.ExecuteReader()
If Xreader.HasRows Then
Xreader.Read()
TextMerek.Text = Xreader("MEREK")
TextPro.Text = Xreader("PROCESSOR")
TextVGA.Text = Xreader("VGA")
TextHDD.Text = Xreader("HDD")
TextSSD.Text = Xreader("SSD")
TextRAM.Text = Xreader("RAM")
TextOS.Text = Xreader("OS")
TextHarga.Text = Xreader("HARGA")
Button4.Enabled = True
Button5.Enabled = True
Else
TextMerek.Text = "Tidak ada"
Exit Sub
End If
Xreader.Close()
End If
End Sub
Button View
Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Response.Redirect("WebFormView.aspx")
End Sub
Button Update
Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
objekKoneksi.Open()
Dim Update As String = "UPDATE TableLaptop set HARGA='" + TextHarga.Text + "' where MEREK='" + Trim(TextMerek.Text) + "'"
Dim oCmd = New OleDbCommand(Update, objekKoneksi)
oCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("Berhasil dirubah")
End Sub
Button Hapus
Protected Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
objekKoneksi.Open()
Dim oCmd As New OleDb.OleDbCommand("DELETE * FROM TableLaptop where MEREK='" + TextMerek.Text + "'", objekKoneksi)
oCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("Berhasil dihapus")
End Sub
End Class
Wassalamu'alaikum Wr. Wb.







Komentar
Posting Komentar