ASP and Acess DB - "Like" Query problem
//ACCESS
SELECT DISTINCT products.imageUrl FROM products WHERE ((products.pcprod_ParentPrd=5573) AND (products.pcprod_Relationship LIKE '*441*'));
//ASP
SELECT DISTINCT products开发者_StackOverflow中文版.imageUrl FROM products WHERE ((products.pcprod_ParentPrd="&pidProduct&") AND (products.pcprod_Relationship LIKE '*"&rsCS("idoptoptgrp")&"*'));
this query works when i'm manually running the query in Access database. but when I run it from ASP. it doesn't return and rows
@user670111: In your ASP you have to use %
instead of *
as the wild-card character.
So rewrite your query in ASP as
SELECT DISTINCT products.imageUrl FROM products WHERE (products.pcprod_ParentPrd = " & pidProduct & ") AND (products.pcprod_Relationship LIKE '%" & rsCS("idoptoptgrp") & "%')
Maybe the values of pidProduct & rsCS("idoptoptgrp") are not what you are expecting it to be?
Does it work when you try ...
((products.pcprod_ParentPrd=" & 5573 & ") AND (products.pcprod_Relationship LIKE '*" & 441 & "*'));
精彩评论