0% found this document useful (0 votes)
31 views4 pages

AHA!

Uploaded by

Kim Karl Heraldo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views4 pages

AHA!

Uploaded by

Kim Karl Heraldo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Creating an online hotel reservation system involves both frontend (HTML) and backend

(VB.NET) development. Here's a simplified example to help you get started. Keep in
mind that this is a basic illustration, and in a real-world scenario, you would need to
consider security, validation, and other aspects.

Frontend (HTML):

Create an HTML form for users to input their reservation details.

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Hotel Reservation System</title>

</head>

<body>

<h1>Hotel Reservation</h1>

<form action="ReservationHandler.aspx" method="post">

<label for="name">Name:</label>

<input type="text" id="name" name="name" required><br>

<label for="checkin">Check-in Date:</label>

<input type="date" id="checkin" name="checkin" required><br>

<label for="checkout">Check-out Date:</label>

<input type="date" id="checkout" name="checkout" required><br>

<label for="roomtype">Room Type:</label>

<select id="roomtype" name="roomtype">

<option value="single">Single Room</option>


<option value="double">Double Room</option>

<option value="suite">Suite</option>

</select><br>

<input type="submit" value="Submit Reservation">

</form>

</body>

</html>

Backend (VB.NET):

Create a backend page (e.g., ReservationHandler.aspx.vb) to process the form


submission.

Imports System.Data.SqlClient

Partial Class ReservationHandler

Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Request.HttpMethod = "POST" Then

Dim name As String = Request.Form("name")


Dim checkin As String = Request.Form("checkin")

Dim checkout As String = Request.Form("checkout")

Dim roomtype As String = Request.Form("roomtype")

' You should perform validation and sanitation of input data here

' Insert the reservation into the database (assuming SQL Server for simplicity)

Dim connectionString As String = "YourConnectionString"

Using connection As New SqlConnection(connectionString)

connection.Open()

Dim query As String = "INSERT INTO Reservations (Name, CheckIn, CheckOut, RoomType)
VALUES (@Name, @CheckIn, @CheckOut, @RoomType)"

Using command As New SqlCommand(query, connection)

command.Parameters.AddWithValue("@Name", name)

command.Parameters.AddWithValue("@CheckIn", checkin)

command.Parameters.AddWithValue("@CheckOut", checkout)

command.Parameters.AddWithValue("@RoomType", roomtype)

command.ExecuteNonQuery()

End Using

End Using

' You can redirect to a confirmation page or do other processing as needed

Response.Redirect("ConfirmationPage.aspx")

End If

End Sub

End Class
Make sure to replace "YourConnectionString" with your actual database connection
string. Also, create a database table named Reservations with appropriate columns ( ID,
Name, CheckIn, CheckOut, RoomType, etc.) to store reservation information.

This is a basic example, and in a production environment, you would need to consider
additional features like authentication, error handling, and possibly use a more robust
framework for building web applications.

You might also like