hey i m creating a page for seat reservation for online ticketing.... i want my booked seats whose status is1 shud turn green and unbooked wih status 0 shud remain red...
i m facing problem in object of data reader ...i ve to create array for data reader object so that it cud store all seats value 1 to 50...but the error saying out of bonds is occuring....following is my snippet...pls help
public partial class Default6 : System.Web.UI.Page
{
public static int seats;
int bookedseats;
string query;
int[] array = new int[50];
string strcon = System.Configuration.ConfigurationManager.ConnectionStrings["online_ticketing3ConnectionString"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
bookedseats = System.Convert.ToInt32(Label19.Text);
Label14.Text = Request.QueryString["value"];
//Label18.Text = Request.QueryString["value"];
SqlConnection conbal;
SqlCommand cmdbal;
SqlDataReader reabal;
query = "select top 49 seat_status from seat_info,movie_info,hall_info";
conbal = new SqlConnection(strcon);
cmdbal = new SqlCommand();
cmdbal.Connection = conbal;
cmdbal.CommandText = query;
conbal.Open();
reabal = cmdbal.ExecuteReader();
for (int i =0; i < 50; ++i)
{
string b;
if (reabal.Read())
{
b = reabal[i].ToString();
int status;
status = System.Convert.ToInt32(b);
if (status == 1 && i == 0 )
{
ImageButton51.ImageUrl = "~/green.bmp";
}
else if (status == 1 && i == 1)
{
ImageButton52.ImageUrl = "~/green.bmp";
}
else if (status == 1 && i == 6)
{
ImageButton53.ImageUrl = "~/green.bmp";
}
}
}
}