V
vazperen
I am very new to databases. I am getting the following error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
/resultsadv.asp, line 45
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Roadrunner; .NET
CLR 1.1.4322)
Page:
POST 73 bytes to /resultsadv.asp
POST Data:
type=%25&minyear=1951&maxyear=2003&minprice=0&maxprice=1000&Submit=Sear-
ch
This is the code:
Dim rsSearch__varType
rsSearch__varType = "%"
If (Request.Form("type") <> "") Then
rsSearch__varType = Request.Form("type")
End If
%>
<%
Dim rsSearch__varStartPrice
rsSearch__varStartPrice = "1"
If (Request.Form("minprice") <> "") Then
rsSearch__varStartPrice = Request.Form("minprice")
End If
%>
<%
Dim rsSearch__varEndPrice
rsSearch__varEndPrice = "1000000"
If (Request.Form("maxprice") <> "") Then
rsSearch__varEndPrice = Request.Form("maxprice")
End If
%>
<%
Dim rsSearch__varStartYear
rsSearch__varStartYear = "1800"
If (Request.Form("minyear") <> "") Then
rsSearch__varStartYear = Request.Form("minyear")
End If
%>
<%
Dim rsSearch__varEndYear
rsSearch__varEndYear = "2003"
If (Request.Form("maxyear") <> "") Then
rsSearch__varEndYear = Request.Form("maxyear")
End If
%>
<%
set rsSearch = Server.CreateObject("ADODB.Recordset")
rsSearch.ActiveConnection = MM_classifieds_STRING
rsSearch.Source = "SELECT * FROM ADS,AD_IMAGES,CATS,SUBS, TYPES WHERE
AD_APPROVED = 1 AND ADS.AD_ID=AD_IMAGES.AD_ID AND CATS.CAT_ID LIKE
ADS.CAT_ID AND SUBS.SUB_ID LIKE ADS.SUB_ID AND AD_EXPIRED > DATE() AND
ADS.TYPE_ID=TYPES.TYPE_ID AND TYPE_NAME like '" +
Replace(rsSearch__varType, "'", "''") + "' AND AD_PRICE BETWEEN " +
Replace(rsSearch__varStartPrice, "'", "''") + " AND " +
Replace(rsSearch__varEndPrice, "'", "''") + " AND YEAR BETWEEN " +
Replace(rsSearch__varStartYear, "'", "''") + " AND " +
Replace(rsSearch__varEndYear, "'", "''") + " ORDER BY CAT_NAME ASC"
rsSearch.CursorType = 0
rsSearch.CursorLocation = 2
rsSearch.LockType = 3
rsSearch.Open()
rsSearch_numRows = 0
I am doing a search that includes several fields sych as model, year,
and price. I do not know what's wrong.
Help!
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
/resultsadv.asp, line 45
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Roadrunner; .NET
CLR 1.1.4322)
Page:
POST 73 bytes to /resultsadv.asp
POST Data:
type=%25&minyear=1951&maxyear=2003&minprice=0&maxprice=1000&Submit=Sear-
ch
This is the code:
Dim rsSearch__varType
rsSearch__varType = "%"
If (Request.Form("type") <> "") Then
rsSearch__varType = Request.Form("type")
End If
%>
<%
Dim rsSearch__varStartPrice
rsSearch__varStartPrice = "1"
If (Request.Form("minprice") <> "") Then
rsSearch__varStartPrice = Request.Form("minprice")
End If
%>
<%
Dim rsSearch__varEndPrice
rsSearch__varEndPrice = "1000000"
If (Request.Form("maxprice") <> "") Then
rsSearch__varEndPrice = Request.Form("maxprice")
End If
%>
<%
Dim rsSearch__varStartYear
rsSearch__varStartYear = "1800"
If (Request.Form("minyear") <> "") Then
rsSearch__varStartYear = Request.Form("minyear")
End If
%>
<%
Dim rsSearch__varEndYear
rsSearch__varEndYear = "2003"
If (Request.Form("maxyear") <> "") Then
rsSearch__varEndYear = Request.Form("maxyear")
End If
%>
<%
set rsSearch = Server.CreateObject("ADODB.Recordset")
rsSearch.ActiveConnection = MM_classifieds_STRING
rsSearch.Source = "SELECT * FROM ADS,AD_IMAGES,CATS,SUBS, TYPES WHERE
AD_APPROVED = 1 AND ADS.AD_ID=AD_IMAGES.AD_ID AND CATS.CAT_ID LIKE
ADS.CAT_ID AND SUBS.SUB_ID LIKE ADS.SUB_ID AND AD_EXPIRED > DATE() AND
ADS.TYPE_ID=TYPES.TYPE_ID AND TYPE_NAME like '" +
Replace(rsSearch__varType, "'", "''") + "' AND AD_PRICE BETWEEN " +
Replace(rsSearch__varStartPrice, "'", "''") + " AND " +
Replace(rsSearch__varEndPrice, "'", "''") + " AND YEAR BETWEEN " +
Replace(rsSearch__varStartYear, "'", "''") + " AND " +
Replace(rsSearch__varEndYear, "'", "''") + " ORDER BY CAT_NAME ASC"
rsSearch.CursorType = 0
rsSearch.CursorLocation = 2
rsSearch.LockType = 3
rsSearch.Open()
rsSearch_numRows = 0
I am doing a search that includes several fields sych as model, year,
and price. I do not know what's wrong.
Help!