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
None
0 Points
11 Posts
Seat reservation program
Jan 23, 2013 12:13 PM|j0zef|LINK
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?
All-Star
35218 Points
9955 Posts
Moderator
Re: Seat reservation program
Jan 23, 2013 12:52 PM|bbcompent1|LINK
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.
None
0 Points
11 Posts
Re: Seat reservation program
Jan 23, 2013 12:58 PM|j0zef|LINK
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
All-Star
35218 Points
9955 Posts
Moderator
Re: Seat reservation program
Jan 23, 2013 01:01 PM|bbcompent1|LINK
Can you post your code?
None
0 Points
11 Posts
Re: Seat reservation program
Jan 23, 2013 01:12 PM|j0zef|LINK
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
All-Star
35218 Points
9955 Posts
Moderator
Re: Seat reservation program
Jan 23, 2013 01:15 PM|bbcompent1|LINK
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?
None
0 Points
11 Posts
Re: Seat reservation program
Jan 23, 2013 01:18 PM|j0zef|LINK
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,...
All-Star
35218 Points
9955 Posts
Moderator
Re: Seat reservation program
Jan 23, 2013 01:19 PM|bbcompent1|LINK
You could post the page's HTML so we can see what the html is doing.
None
0 Points
11 Posts
Re: Seat reservation program
Jan 23, 2013 01:22 PM|j0zef|LINK
this is my html code
All-Star
35218 Points
9955 Posts
Moderator
Re: Seat reservation program
Jan 23, 2013 02:18 PM|bbcompent1|LINK
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.
All-Star
94130 Points
18109 Posts
Re: Seat reservation program
Jan 24, 2013 08:49 PM|Decker Dong - MSFT|LINK
Hi again,
Can you show us your code-behind?
I mean cs file's codes?
Any logic errors?
All-Star
35218 Points
9955 Posts
Moderator
Re: Seat reservation program
Jan 25, 2013 07:19 AM|bbcompent1|LINK
That is what I have been asking him for but the OP has yet to post it. Still waiting patiently.
All-Star
35218 Points
9955 Posts
Moderator
Re: Seat reservation program
Jan 25, 2013 12:37 PM|bbcompent1|LINK
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.
None
0 Points
11 Posts
Re: Seat reservation program
Jan 26, 2013 06:44 AM|j0zef|LINK
this is my code.
I have a error by button(i).backcolor
All-Star
94130 Points
18109 Posts
Re: Seat reservation program
Jan 26, 2013 07:32 AM|Decker Dong - MSFT|LINK
Hi j0zef,
Button in asp.net really has the property of BackColor,and Is your Button of a List?
None
0 Points
11 Posts
Re: Seat reservation program
Jan 26, 2013 08:10 AM|j0zef|LINK
I have create 150 buttons with the name button1,button2,button3
I have selected in the toolbox 150 buttons
All-Star
25756 Points
7014 Posts
Re: Seat reservation program
Jan 26, 2013 04:47 PM|hans_v|LINK
j0zef,
Perhaps you better send me a Private Message (in dutch? )
All-Star
94130 Points
18109 Posts
Re: Seat reservation program
Jan 26, 2013 07:38 PM|Decker Dong - MSFT|LINK
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.
None
0 Points
11 Posts
Re: Seat reservation program
Jan 27, 2013 03:55 AM|j0zef|LINK
and how can I create a list of buttons?
All-Star
94130 Points
18109 Posts
Re: Seat reservation program
Jan 27, 2013 04:10 AM|Decker Dong - MSFT|LINK
Hi again,
Just create a List(Of Button), and then dynamically add Button to the List instance and show the Button onto webpage.