D
Dave
This is my query named "spVOC_Sp_Example_search" in Access 2003:
PARAMETERS [pSearch] Text ( 255 );
SELECT Example.Example
FROM Example
WHERE (((Example.Example) Like "*" & [pSearch] & "*"));
It works great: I call the query, am prompted for the pSearch param value,
I supply a string as the value, and it returns all records with that string
contained anyhwere in the "example" field.
But none of the queries below will work in ASP 3.0:
Set rs = Server.CreateObject("ADODB.recordset")
sSQL="spVOC_Sp_Example_search pSearch=%a%"
sSQL="spVOC_Sp_Example_search pSearch=*"
sSQL="spVOC_Sp_Example_search pSearch=%"
sSQL="spVOC_Sp_Example_search pSearch='a'"
sSQL="spVOC_Sp_Example_search pSearch=""a"""
sSQL="spVOC_Sp_Example_search a"
sSQL="spVOC_Sp_Example_search *a*"
sSQL="spVOC_Sp_Example_search %a%"
sSQL="spVOC_Sp_Example_search %"
sSQL="spVOC_Sp_Example_search *"
sSQL="spVOC_Sp_Example_search ''"
rs.Open sSQL, cn, 0, 4
i=rs.RecordCount
All of the queries above either return 0 records or error out (Invalid SQL
statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.)
How do I properly call an Access parameterized wildcard query from ASP?
PARAMETERS [pSearch] Text ( 255 );
SELECT Example.Example
FROM Example
WHERE (((Example.Example) Like "*" & [pSearch] & "*"));
It works great: I call the query, am prompted for the pSearch param value,
I supply a string as the value, and it returns all records with that string
contained anyhwere in the "example" field.
But none of the queries below will work in ASP 3.0:
Set rs = Server.CreateObject("ADODB.recordset")
sSQL="spVOC_Sp_Example_search pSearch=%a%"
sSQL="spVOC_Sp_Example_search pSearch=*"
sSQL="spVOC_Sp_Example_search pSearch=%"
sSQL="spVOC_Sp_Example_search pSearch='a'"
sSQL="spVOC_Sp_Example_search pSearch=""a"""
sSQL="spVOC_Sp_Example_search a"
sSQL="spVOC_Sp_Example_search *a*"
sSQL="spVOC_Sp_Example_search %a%"
sSQL="spVOC_Sp_Example_search %"
sSQL="spVOC_Sp_Example_search *"
sSQL="spVOC_Sp_Example_search ''"
rs.Open sSQL, cn, 0, 4
i=rs.RecordCount
All of the queries above either return 0 records or error out (Invalid SQL
statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'.)
How do I properly call an Access parameterized wildcard query from ASP?