开发者

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 & "*'));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜