protected void searchBtn_Click(object sender, EventArgs e) { //when the search button is selected these controls become visible selectRoomLbl.Visible = true; reserveBtn.Visible = true; ListView1.Visible = true; try { //creates a connection to the database dbConnection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Request.PhysicalApplicationPath + "App_Data\\Mercure.accdb"); dbConnection.Open(); //query retrieves all available rooms for reservation string query = "SELECT * FROM RoomsDetails WHERE roomID NOT IN("; query += "SELECT roomID FROM ReservationDetails WHERE NOT("; query += "dateArrival < " + arrivalTxt.Text + "OR dateDeparture > " + departureTxt.Text + "))"; query += "ORDER BY RoomsDetails.roomID"; OleDbCommand cmd = dbConnection.CreateCommand(); cmd.CommandText = query; OleDbDataReader dbReader = cmd.ExecuteReader(); if (dbReader != null && dbReader.HasRows) { while (dbReader.Read()) { //I am not too sure how to display in the listview control } } } finally { dbConnection.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)