Pada tugas UAS kali ini, saya akan membuat aplikasi pembayaran kamar hotel dan memesan kamar hotel versi Web menggunakan aplikasi visual studio, dengan menggunakan browser seperti,google chrome dll.Aplikasi ini menggunakan database Microsoft Access.Aplikasi saya ini sebagai tempat penginapan dan berbagai kegiatan yang dilaksanakan oleh para tamu.
Komponen
- Label
- TextBox
- Button
Tampilan Microsoft Access
Tampilan Design
Tampilan View Design
Setelah di Run
Tampilan Cari
Tampilan Run
Berikut Kodingannya
Sourcode
Imports System.Data
Imports System.Data.OleDb
Public Class WebFormHotel
Inherits System.Web.UI.Page
Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\LENOVO\Documents\DBHotel.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 Hotel values('" & TextNo.Text & "','" & TextJenis.Text & "','" & TextFasilitas.Text & "','" & TextLantai.Text & "','" & TextTarif.Text & "')"
Dim oCmd = New OleDbCommand(tambah, objekKoneksi)
oCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("Selamat Anda Sukses Gan")
End Sub
Button Cari
Protected Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
If Not Len(TextNo.Text) = 0 Then
objekKoneksi.Close()
objekKoneksi.Open()
Dim ocmd As New OleDb.OleDbCommand("SELECT * FROM Hotel where NOKAMAR='" + TextNo.Text + "'", objekKoneksi)
Xreader = ocmd.ExecuteReader()
If Xreader.HasRows Then
Xreader.Read()
TextNo.Text = Xreader("NOKAMAR")
TextJenis.Text = Xreader("JENISKAMAR")
TextFasilitas.Text = Xreader("FASILITAS")
TextLantai.Text = Xreader("LANTAIKE")
TextTarif.Text = Xreader("TARIF")
Button4.Enabled = True
Else
TextNo.Text = "Nama Hotel 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("WebFormWeb.aspx")
End Sub
Button Update
Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
objekKoneksi.Open()
Dim Rubah As String = "Update Hotel set TARIF='" + TextTarif.Text + "' where NOKAMAR='" + (TextNo.Text) + "'"
Dim oCmd = New OleDbCommand(Rubah, objekKoneksi)
oCmd.ExecuteNonQuery()
objekKoneksi.Close()
MsgBox("Sukses Gan")
End Sub
Button Hapus/Delete
Protected Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
TextNo.Text = ""
TextJenis.Text = ""
TextFasilitas.Text = ""
TextLantai.Text = ""
TextTarif.Text = ""
End Sub
End Class






0 komentar:
Posting Komentar