<%
set conn = CreateObject("ADODB.Connection")
conn.open strConnection
sql = sql="Select t.hotels_id,t.roomtype_id, t.startdate, t.enddate, t.capacity, count(t.room_no) as total_room from h_room t where t.hotels_id=" &request("id")&" and t.capacity="&request("capacity")&"and (('" & request("startdate") & "' Between t.startdate And t.enddate)) and (('" & DateAdd("d",-1,request("closingdate")) & "' Between t.startdate And t.enddate)) and not exists (SELECT DISTINCT b.room_id FROM h_bookinfo a,h_room_booked b WHERE a.bookinfo_id=(b.bookinfo_id) and hotels_id="&request("id")&" and b.room_id=t.room_id and ((manual_booking='"&true&"' or status='"&true&"') or (manual_booking='"&true&"' and status='"&true&"')) and (('" & request("startdate") & "' Between checkin_date And checkout_date Or checkin_date between '" & request("startdate") & "' and '" & DateAdd("d",-1,request("closingdate")) & "') Or ('" & DateAdd("d",-1,request("closingdate")) & "' Between checkin_date And checkout_date Or checkout_date between '" & request("startdate") & "' and '" &DateAdd("d",-1,request("closingdate")) & "') ))group by t.hotels_id,t.roomtype_id,t.capacity,t.startdate,t.enddate"
on error resume next
conn.execute(sql)
if err.number <> 0 then
response.write(sql)
if conn.errors.count > 0 then
for each e in conn.errors
response.write e.description & "<br>"
next
end if
response.end
end if