Hello my friends , Can you help with this erros ?? I change my data base from access to sqlserver 2008 and i have this problem . something wrong with dates syntax ??? Thank you in advance for any help !!! 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=val(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 "&"" ' response.Write(sql) rs.open sql,conn,1,3 LINE 201 ERROR
Making the conversion from Access to SQL Server isn't as easy as you would hope, especially considering they're both MS products If I remember SQL SERVER doesn't use the # -- check the SQL Srv documentation to see what they correct usage is for strings. Then you'll need to make this change to all your SQL strings...