T
Terry
Hi,
I'm trying to call a parameterized query in Access 97 from an ASP page.
I've done this before many times with success but now I'm stuck.
My ASP page offers a keyword search of Products. The user can input a
value and the system will try to match that against a few DB fields,
namely:
ProID; Long Integer
ProCode; Text(50)
ProNom; Text(255)
ProDescription; Text(255)
So for example, if you entered '12', the system would return all
products where the string '12' is found either in ProID, ProCode,
ProNom or ProDescription.
The query is defined as such:
PARAMETERS [@SearchTerm] Text;
SELECT * FROM Products
WHERE ((CStr([ProID])) Like ("*" & [@SearchTerm] & "*"))
OR
(ProCode Like ("*" & [@SearchTerm] & "*"))
OR
(ProNom Like ("*" & [@SearchTerm] & "*"))
OR
(ProDescription Like ("*" & [@SearchTerm] & "*"));
The parameter in ASP is defined as such:
objCmd.CreateParameter("@SearchTerm", adVarChar, adParamInput,
Len(p_strMySearchTerm), cstr(p_strMySearchTerm))
If I execute the query directly from Access, everything works fine and
I get the expected results. However, calling from the ASP page with the
same parameter returns an empty recordset. I have checked that the
parameter is indeed passed and has the correct value.
Any ideas?
I'm trying to call a parameterized query in Access 97 from an ASP page.
I've done this before many times with success but now I'm stuck.
My ASP page offers a keyword search of Products. The user can input a
value and the system will try to match that against a few DB fields,
namely:
ProID; Long Integer
ProCode; Text(50)
ProNom; Text(255)
ProDescription; Text(255)
So for example, if you entered '12', the system would return all
products where the string '12' is found either in ProID, ProCode,
ProNom or ProDescription.
The query is defined as such:
PARAMETERS [@SearchTerm] Text;
SELECT * FROM Products
WHERE ((CStr([ProID])) Like ("*" & [@SearchTerm] & "*"))
OR
(ProCode Like ("*" & [@SearchTerm] & "*"))
OR
(ProNom Like ("*" & [@SearchTerm] & "*"))
OR
(ProDescription Like ("*" & [@SearchTerm] & "*"));
The parameter in ASP is defined as such:
objCmd.CreateParameter("@SearchTerm", adVarChar, adParamInput,
Len(p_strMySearchTerm), cstr(p_strMySearchTerm))
If I execute the query directly from Access, everything works fine and
I get the expected results. However, calling from the ASP page with the
same parameter returns an empty recordset. I have checked that the
parameter is indeed passed and has the correct value.
Any ideas?