Hello. I'm currently preparing a seating system in VB. May i know how can I change the booked seats into available by clicking "Reset" button? My database consists of "Booking" table that comprises the booking details and "Seating" table that comprises details including "Availability" whereby once the seats are booked, it will change the seats from available to booked under "Availability" column.

As per my understanding, when i click the "Reset" button, it will delete the records in "Booking" table and update "Seating" table from booked to Available under "Availability" column. This action would lead my booked seats turn to available seats.

I'm looking for guidance on this issue. Thank you in advance!

1st_auditorium.PNG

Recommended Answers

All 8 Replies

Anyone to help?

Since I can't find a design specification, only you can decide what those buttons do.

Now to help move things along some observations and comments.

  1. I can't find a question in your top post. So it's hard for folk to guess what your question is.
  2. In such seating and reservation systems you have your admin and per user view. The admin would be capable of a full reset, the user should only reset their choices so far or commit to the seating but at no time would the user/buyer control all seating.
  3. As such another column may be who owns those seats so a reset from the user view would only uncommit their selected seats.
commented: 1. I'm looking for help to code "Reset" button so that all the booked seats turn to available +0

Next, the system is based on admin view only. The "Reset" button functions to clear all the booked seats to available so that the hall can be used for the following showtime.

As to the code, that would be the same code that you wrote to initialize the database. Maybe you need to share your code and point out where you are stuck as to line number or syntax. And to be clear I don't see members writing the code or system for you. They help you past the error or share ideas about the system but to get others to code it for you, you may have to post a help wanted with rates for the system you would pay.

Hi, sir. This is the code I use for my reset button:

Dim stSQL As String
    stSQL = "DELETE BookingID,Customer, Seat FROM tblBooking"

    Dim stConString As String
    stConString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\USER\Desktop\Cinema\Database\Data.accdb"

    Dim conBookings As OleDbConnection
    conBookings = New OleDbConnection
    conBookings.ConnectionString = stConString
    conBookings.Open()

    Dim cmdSelectBookings As OleDbCommand
    cmdSelectBookings = New OleDbCommand
    cmdSelectBookings.CommandText = stSQL
    cmdSelectBookings.Connection = conBookings

    'Dim cmdSelectBookings As New OleDbCommand(stSQL, conBookings)

    Dim dsBookings As New DataSet
    Dim daBookings As New OleDbDataAdapter(cmdSelectBookings)
    daBookings.Fill(dsBookings, "Bookings")
    conBookings.Close()

    'MsgBox(dsBookings.Tables("Bookings").Rows.Count)
    'MsgBox(dsBookings.Tables("Bookings").Rows(0).Item(1))

    Dim stOut As String
    Dim t1 As DataTable = dsBookings.Tables("Bookings")
    Dim row As DataRow

    For Each row In t1.Rows
        'stOut = stOut & row(0) & "" & row(1) & "" & row(2) & vbNewLine
        DirectCast(Panel1.Controls("PictureBox" & row(2).ToString), PictureBox).Image = bookedIcon

    Next
    'MsgBox(stOut)

End Sub

The whole coding, I presume. Because this coding deletes the record without even clicking "Reset" button on the system. I only want the button functions to delete the record before the next showtime. :(

I'm going to guess you are new to VB. I see at line 38 the usual End Sub but can't find the beginning of said routine. You are also seem to be filling all the rows as bookedIcon in line 33 but I see in line 2 your command is to delete all the data. So anytime this un-named procedure runs (you don't tell how) that line 2 appears to be the clear the database command.

As you may be new to VB, tell me how you tied this unknown procedure to your reset button.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.