Forums
This topic is locked
sql for reading and filtering DB based on two stri
Posted 06 Aug 2007 17:54:27
1
has voted
06 Aug 2007 17:54:27 Ciaran Leeper posted:
I am reading 2 string values from a drop down list - these values then act as my filters for searching my database.The two string values varTown and varBeds are passed via the get method to the page below that will display the results
<pre id=code><font face=courier size=2 id=code><!--#include file="Connections/ConnTyronerentals.asp" -->
<%
Dim Recordset1__Location
Recordset1__Location = "Omagh"
If (Request.QueryString("varTown" <> "" Then
Recordset1__Location = Request.QueryString("varTown"
End If
%>
<%
Dim Recordset1__NoBeds
Recordset1__NoBeds = "3"
If (Request.QueryString("varBeds" <> "" Then
Recordset1__NoBeds = Request.QueryString("varBeds"
End If
%>
<%
Dim Recordset1
Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_ConnTyronerentals_STRING
Recordset1.Source = "SELECT Address FROM HouseDetails WHERE Town = '" + Replace(Recordset1__Location, "'", "''" + "' AND Beds ='" + Replace(Recordset1__NoBeds, "'", "''" + "'"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()</font id=code></pre id=code>
I recieve the error Data type mismatch in criteria expression. I assmue there is a problem with my sql. Is this the case, and how do i get arround this
Please Help