locked
Seat reservation program RRS feed

  • Question

  • User1454449579 posted

    Hello,

    I would like to make a seat reservation program with a access database.

    I have 150 seats I use 150 buttons for this.

    In my database ik have a columm seatnumber from 1 to 150 and I have a columm booked with "0" and "1" values: 0 = free 1 = booked.

    In my page_load i want to make a query that looks which seats are booked en which seats are free.

    The free seats buttons are green and the booked are red. 

    so thats my problem I cant find the qeury that the buttons change the colors.

    Can someone help me?

    Wednesday, January 23, 2013 12:13 PM

Answers

  • User3866881 posted

    and how can I create a list of buttons?

    Hi again,

    Just create a List(Of Button), and then dynamically add Button to the List instance and show the Button onto webpage.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 27, 2013 4:10 AM

All replies

  • User-718146471 posted

    Take a look at this link: http://forums.asp.net/post/5268934.aspx

    This was a thread I was part of recently and it sounds like you want to do something similar.

    Wednesday, January 23, 2013 12:52 PM
  • User1454449579 posted

    I have no problem with the design but i have a problem with my query.

    I cant found a query that when Booked = 1 then the buttons that are booked that the color doens't change to red

    Wednesday, January 23, 2013 12:58 PM
  • User-718146471 posted

    Can you post your code?

    Wednesday, January 23, 2013 1:01 PM
  • User1454449579 posted

    I dont have much code, i'm still trying :)

    but so it should look like.  

    the black seats are reserved and the red seat are the selected seats. 

     this is my access database table

    the first columm are the seat number and the second columm are the 0 and 1 booked or free

    Wednesday, January 23, 2013 1:12 PM
  • User-718146471 posted

    So, how are you generating this layout you show in the picture? The code that generates the grid you are showing, can you show us that?

    Wednesday, January 23, 2013 1:15 PM
  • User1454449579 posted

    I selected 150 buttons in my toolbox and set them in my design :) i have no code for that :)

    the buttons id names are: button1,button2,button3,... 

    Wednesday, January 23, 2013 1:18 PM
  • User-718146471 posted

    You could post the page's HTML so we can see what the html is doing.

    Wednesday, January 23, 2013 1:19 PM
  • User1454449579 posted

    this is my html code

    <%@ Page Title="Zitjes" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Zitjes.aspx.vb" Inherits="GP_FILMCLUB_ZULTE.WebForm9" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
        </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <h2>
            <br />
            <b><strong>Zitjes</strong></b></h2>
        <p>
            <asp:Button ID="Button1" runat="server" Text="Button" />
            <asp:Button ID="Button2" runat="server" Text="Button" />
            <asp:Button ID="Button3" runat="server" Text="Button" />
            <asp:Button ID="Button4" runat="server" Text="Button" />
            <asp:Button ID="Button5" runat="server" Text="Button" />
            <asp:Button ID="Button6" runat="server" Text="Button" />
            <asp:Button ID="Button7" runat="server" Text="Button" />
            <asp:Button ID="Button8" runat="server" Text="Button" />
            <asp:Button ID="Button9" runat="server" Text="Button" />
            <asp:Button ID="Button10" runat="server" Text="Button" />
            <asp:Button ID="Button12" runat="server" Text="Button" />
            <asp:Button ID="Button14" runat="server" Text="Button" />
            <asp:Button ID="Button15" runat="server" Text="Button" />
            <asp:Button ID="Button16" runat="server" Text="Button" />
            <asp:Button ID="Button17" runat="server" Text="Button" />
            <asp:Button ID="Button18" runat="server" Text="Button" />
            <asp:Button ID="Button19" runat="server" Text="Button" />
            <asp:Button ID="Button20" runat="server" Text="Button" />
            <asp:Button ID="Button11" runat="server" Text="Button" />
            <asp:Button ID="Button13" runat="server" Text="Button" />
            <asp:Button ID="Button21" runat="server" Text="Button" />
            <asp:Button ID="Button22" runat="server" Text="Button" />
            <asp:Button ID="Button23" runat="server" Text="Button" />
            <asp:Button ID="Button24" runat="server" Text="Button" />
            <asp:Button ID="Button25" runat="server" Text="Button" />
            <asp:Button ID="Button26" runat="server" Text="Button" />
            <asp:Button ID="Button27" runat="server" Text="Button" />
            <asp:Button ID="Button28" runat="server" Text="Button" />
            <asp:Button ID="Button29" runat="server" Text="Button" />
            <asp:Button ID="Button30" runat="server" Text="Button" />
            <asp:Button ID="Button31" runat="server" Text="Button" />
            <asp:Button ID="Button32" runat="server" Text="Button" />
            <asp:Button ID="Button33" runat="server" Text="Button" />
            <asp:Button ID="Button34" runat="server" Text="Button" />
            <asp:Button ID="Button35" runat="server" Text="Button" />
            <asp:Button ID="Button36" runat="server" Text="Button" />
            <asp:Button ID="Button37" runat="server" Text="Button" />
            <asp:Button ID="Button38" runat="server" Text="Button" />
            <asp:Button ID="Button39" runat="server" Text="Button" />
            <asp:Button ID="Button40" runat="server" Text="Button" />
            <asp:Button ID="Button41" runat="server" Text="Button" />
            <asp:Button ID="Button42" runat="server" Text="Button" />
            <asp:Button ID="Button43" runat="server" Text="Button" />
            <asp:Button ID="Button44" runat="server" Text="Button" />
            <asp:Button ID="Button45" runat="server" Text="Button" />
            <asp:Button ID="Button46" runat="server" Text="Button" />
            <asp:Button ID="Button47" runat="server" Text="Button" />
            <asp:Button ID="Button48" runat="server" Text="Button" />
            <asp:Button ID="Button49" runat="server" Text="Button" />
            <asp:Button ID="Button50" runat="server" Text="Button" />
            <asp:Button ID="Button51" runat="server" Text="Button" />
            <asp:Button ID="Button52" runat="server" Text="Button" />
            <asp:Button ID="Button53" runat="server" Text="Button" />
            <asp:Button ID="Button54" runat="server" Text="Button" />
            <asp:Button ID="Button55" runat="server" Text="Button" />
            <asp:Button ID="Button56" runat="server" Text="Button" />
            <asp:Button ID="Button57" runat="server" Text="Button" />
            <asp:Button ID="Button58" runat="server" Text="Button" />
            <asp:Button ID="Button59" runat="server" Text="Button" />
            <asp:Button ID="Button60" runat="server" Text="Button" />
            <asp:Button ID="Button61" runat="server" Text="Button" />
            <asp:Button ID="Button62" runat="server" Text="Button" />
            <asp:Button ID="Button63" runat="server" Text="Button" />
            <asp:Button ID="Button64" runat="server" Text="Button" />
            <asp:Button ID="Button65" runat="server" Text="Button" />
            <asp:Button ID="Button66" runat="server" Text="Button" />
            <asp:Button ID="Button67" runat="server" Text="Button" />
            <asp:Button ID="Button68" runat="server" Text="Button" />
            <asp:Button ID="Button69" runat="server" Text="Button" />
            <asp:Button ID="Button70" runat="server" Text="Button" />
            <asp:Button ID="Button71" runat="server" Text="Button" />
            <asp:Button ID="Button72" runat="server" Text="Button" />
            <asp:Button ID="Button73" runat="server" Text="Button" />
            <asp:Button ID="Button74" runat="server" Text="Button" />
            <asp:Button ID="Button75" runat="server" Text="Button" />
            <asp:Button ID="Button76" runat="server" Text="Button" />
            <asp:Button ID="Button77" runat="server" Text="Button" />
            <asp:Button ID="Button78" runat="server" Text="Button" />
            <asp:Button ID="Button79" runat="server" Text="Button" />
            <asp:Button ID="Button80" runat="server" Text="Button" />
            <asp:Button ID="Button81" runat="server" Text="Button" />
            <asp:Button ID="Button82" runat="server" Text="Button" />
            <asp:Button ID="Button83" runat="server" Text="Button" />
            <asp:Button ID="Button84" runat="server" Text="Button" />
            <asp:Button ID="Button85" runat="server" Text="Button" />
            <asp:Button ID="Button86" runat="server" Text="Button" />
            <asp:Button ID="Button87" runat="server" Text="Button" />
            <asp:Button ID="Button88" runat="server" Text="Button" />
            <asp:Button ID="Button89" runat="server" Text="Button" />
            <asp:Button ID="Button90" runat="server" Text="Button" />
            <asp:Button ID="Button91" runat="server" Text="Button" />
            <asp:Button ID="Button92" runat="server" Text="Button" />
            <asp:Button ID="Button93" runat="server" Text="Button" />
            <asp:Button ID="Button94" runat="server" Text="Button" />
            <asp:Button ID="Button95" runat="server" Text="Button" />
            <asp:Button ID="Button96" runat="server" Text="Button" />
            <asp:Button ID="Button97" runat="server" Text="Button" />
            <asp:Button ID="Button98" runat="server" Text="Button" />
            <asp:Button ID="Button99" runat="server" Text="Button" />
            <asp:Button ID="Button100" runat="server" Text="Button" />
            <asp:Button ID="Button101" runat="server" Text="Button" />
            <asp:Button ID="Button102" runat="server" Text="Button" />
            <asp:Button ID="Button103" runat="server" Text="Button" />
            <asp:Button ID="Button104" runat="server" Text="Button" />
            <asp:Button ID="Button105" runat="server" Text="Button" />
            <asp:Button ID="Button106" runat="server" Text="Button" />
            <asp:Button ID="Button107" runat="server" Text="Button" />
            <asp:Button ID="Button108" runat="server" Text="Button" />
            <asp:Button ID="Button109" runat="server" Text="Button" />
            <asp:Button ID="Button110" runat="server" Text="Button" />
            <asp:Button ID="Button111" runat="server" Text="Button" />
            <asp:Button ID="Button112" runat="server" Text="Button" />
            <asp:Button ID="Button113" runat="server" Text="Button" />
            <asp:Button ID="Button114" runat="server" Text="Button" />
            <asp:Button ID="Button115" runat="server" Text="Button" />
            <asp:Button ID="Button116" runat="server" Text="Button" />
            <asp:Button ID="Button117" runat="server" Text="Button" />
            <asp:Button ID="Button118" runat="server" Text="Button" />
            <asp:Button ID="Button119" runat="server" Text="Button" />
            <asp:Button ID="Button120" runat="server" Text="Button" />
            <asp:Button ID="Button121" runat="server" Text="Button" />
            <asp:Button ID="Button122" runat="server" Text="Button" />
            <asp:Button ID="Button123" runat="server" Text="Button" />
            <asp:Button ID="Button124" runat="server" Text="Button" />
            <asp:Button ID="Button125" runat="server" Text="Button" />
            <asp:Button ID="Button126" runat="server" Text="Button" />
            <asp:Button ID="Button127" runat="server" Text="Button" />
            <asp:Button ID="Button128" runat="server" Text="Button" />
            <asp:Button ID="Button129" runat="server" Text="Button" />
            <asp:Button ID="Button130" runat="server" Text="Button" />
            <asp:Button ID="Button131" runat="server" Text="Button" />
            <asp:Button ID="Button132" runat="server" Text="Button" />
            <asp:Button ID="Button133" runat="server" Text="Button" />
            <asp:Button ID="Button134" runat="server" Text="Button" />
            <asp:Button ID="Button135" runat="server" Text="Button" />
            <asp:Button ID="Button136" runat="server" Text="Button" />
            <asp:Button ID="Button137" runat="server" Text="Button" />
            <asp:Button ID="Button138" runat="server" Text="Button" />
            <asp:Button ID="Button139" runat="server" Text="Button" />
            <asp:Button ID="Button140" runat="server" Text="Button" />
            <asp:Button ID="Button141" runat="server" Text="Button" />
            <asp:Button ID="Button142" runat="server" Text="Button" />
            <asp:Button ID="Button143" runat="server" Text="Button" />
            <asp:Button ID="Button144" runat="server" Text="Button" />
            <asp:Button ID="Button145" runat="server" Text="Button" />
            <asp:Button ID="Button146" runat="server" Text="Button" />
            <asp:Button ID="Button147" runat="server" Text="Button" />
            <asp:Button ID="Button148" runat="server" Text="Button" />
            <asp:Button ID="Button149" runat="server" Text="Button" />
            <asp:Button ID="Button150" runat="server" Text="Button" />
        </p>
        </asp:Content>
    

    Wednesday, January 23, 2013 1:22 PM
  • User-718146471 posted

    <%@ Page Title="Zitjes" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Zitjes.aspx.vb" Inherits="GP_FILMCLUB_ZULTE.WebForm9" %> 

    See where it says Zitjes.aspx.vb? We need to see that file. Can you post what you find in there? There has to be something in there.

    Wednesday, January 23, 2013 2:18 PM
  • User3866881 posted

    Hi again,

    Can you show us your code-behind?

    I mean cs file's codes?

    Any logic errors?

    Thursday, January 24, 2013 8:49 PM
  • User-718146471 posted

    That is what I have been asking him for but the OP has yet to post it. Still waiting patiently.

    Friday, January 25, 2013 7:19 AM
  • User-718146471 posted

    j0zef, we want to help you but you have to help us by posting your code behind page. We don't know what your page is doing based on the HTML alone.

    Friday, January 25, 2013 12:37 PM
  • User1454449579 posted
        Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
            Dim conn As New OleDb.OleDbConnection
            Dim cmd As New OleDb.OleDbCommand
            Dim i As Integer
    
    
            conn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\daan\Desktop\GP_FILMCLUB_ZULTE\GP_FILMCLUB_ZULTE\App_Data\GP_DATABASE_FILMCLUB.accdb"
            cmd.Connection = conn
            For i = 1 To 150
                If cmd.CommandText = "Select Stoelnr = " & i & " FROM Zitjes Where Stoeltjes 1" Then
                    Button(i).BackColor = Drawing.Color.Red
                Else
    
                    Button1(i).BackColor = Drawing.Color.Green
    
                End If
            Next
    
        End Sub
    
    End Class

    this is my code.

    I have a error by button(i).backcolor

    Saturday, January 26, 2013 6:44 AM
  • User3866881 posted

    Hi j0zef,

    Button in asp.net really has the property of BackColor,and Is your Button of a List?

    Saturday, January 26, 2013 7:32 AM
  • User1454449579 posted

    I have create 150 buttons with the name button1,button2,button3

    I have selected in the toolbox 150 buttons

    Saturday, January 26, 2013 8:10 AM
  • User-1199946673 posted

    j0zef,

    Perhaps you better send me a Private Message (in dutch? )

    Saturday, January 26, 2013 4:47 PM
  • User3866881 posted

    I have create 150 buttons with the name button1,button2,button3

    But that's not a list or a collection of Button……

    If you insist doing so,you have to create a List<Button>,and then use your codes.

    Saturday, January 26, 2013 7:38 PM
  • User1454449579 posted

    j0zef

    I have create 150 buttons with the name button1,button2,button3

    But that's not a list or a collection of Button……

    If you insist doing so,you have to create a List<Button>,and then use your codes.

    and how can I create a list of buttons?

    Sunday, January 27, 2013 3:55 AM
  • User3866881 posted

    and how can I create a list of buttons?

    Hi again,

    Just create a List(Of Button), and then dynamically add Button to the List instance and show the Button onto webpage.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, January 27, 2013 4:10 AM