display the numbers in combobox

Asked By goldy gupta
02-Sep-10 01:15 AM
Earn up to 0 extra points for answering this tough question.

hello to all i am making an vb.net  windows application..
i have two combo box  one is of reserved seats and another of available seats

now in reserved seat combo box the values are coming from database(maximum seats are 50)


suppose seat no. 5 and 8 are reserved...now i want that the remainning seats rxcept 5 an8  should come in   available combo box

how it will happen..please help
thanks in advance

  re: display the numbers in combobox

Santhosh N replied to goldy gupta
02-Sep-10 02:01 AM
You could have a column in the table to mark the reserved seats with some flag and while showing in the dropdown, in the query have the flag condition not to include reserved seat numbers..

  re: display the numbers in combobox

Venkat K replied to goldy gupta
02-Sep-10 02:08 AM
Helo gupta

This logic you need to maintain in the database. You can add a new columns booked in the table so that you can update it with a value 0/1 based on the booking status.

Support as per your example if 5 and 8 are booked then the data in the database should be as below:
(here in booked
0-refers not booked
1 - refers booked


SeatNo.  Booked
  1      0
  2      0
  3      0
  4      0
  5      1
  6      0
  7      0
  8      1

So when you are retieving values in the first combobox then you need to fetch the values using the below query

SELECT SeatNo FROM tblSeats WHERE Booked=0
So this query will return only the empty seats. When a seat is booked you need to update the booked column value with 1 as below:

UPDATE tblSeats SET Booked=1 WHERE SeatNo=@seatnumber

Hope this helps you!
Thanks
Create New Account