在ASP中查询Access的问题 [英] Trouble with Access Like Query in ASP
问题描述
我使用ASP和
Access数据库的Like Query获得了意想不到的结果。
此查询 -
选择PN,Qty来自库存,其中PN喜欢''SSW-10%'';
返回我的预期:
PN数量
SSW -101-01-TD 1780
SSW-101-01-TD 1780
SSW-102-01-GD 8900
....但是这一个 -
SELECT PN,Qty From Inventory Where PN Like''SSW-101%'';
返回0结果,即使看在上面的结果中,它应该
返回2条记录。
唯一的区别是附加字符''101%''与''10 %''。
离线,它会返回我的预期。
提前致谢。
I am getting unexpected results with a Like Query using ASP and an
Access database.
This query -
SELECT PN, Qty From Inventory Where PN Like ''SSW-10%'';
returns what I expect:
PN Qty
SSW-101-01-T-D 1780
SSW-101-01-T-D 1780
SSW-102-01-G-D 8900
.... but this one -
SELECT PN, Qty From Inventory Where PN Like ''SSW-101%'';
returns 0 results, even though looking at the results above, it should
return 2 of the records.
The only difference is the additional character ''101%'' versus ''10%''.
Offline, it returns what I expect.
Thanks in advance.
推荐答案
怎么样......
喜欢'SSW-101''+''%''
或者
喜欢''SSW-101''& ''%''
-
Jerry Boone
Analytical Technologies,Inc。
http://www.antech.biz
ASP安全托管和开发解决方案,ASP.NET,SQL Server和
访问
" Randy Weber" < RA ****** @ yahoo.com>在消息中写道
新闻:8d ************************** @ posting.google.c om ...
What about...
Like ''SSW-101'' + ''%''
or
Like ''SSW-101'' & ''%''
--
Jerry Boone
Analytical Technologies, Inc.
http://www.antech.biz
Secure Hosting and Development Solutions for ASP, ASP.NET, SQL Server, and
Access
"Randy Weber" <ra******@yahoo.com> wrote in message
news:8d**************************@posting.google.c om...
我使用ASP和一个
Access数据库获得意外结果。
此查询 -
SELECT PN,Qty From Inventory Where PN喜欢''SSW-10%'';
返回我的期望:
PN数量
SSW-101-01-TD 1780
SSW-101-01-TD 1780
SSW-102-01-GD 8900
......但这一个 -
SELECT PN,Qty From Inventory Where PN Like''SSW-101%''; <返回0结果,即使查看上面的结果,它也应该返回2条记录。
唯一的区别是附加字符''101%''与' 10%。
离线,它会返回我的期望。
提前致谢。
I am getting unexpected results with a Like Query using ASP and an
Access database.
This query -
SELECT PN, Qty From Inventory Where PN Like ''SSW-10%'';
returns what I expect:
PN Qty
SSW-101-01-T-D 1780
SSW-101-01-T-D 1780
SSW-102-01-G-D 8900
... but this one -
SELECT PN, Qty From Inventory Where PN Like ''SSW-101%'';
returns 0 results, even though looking at the results above, it should
return 2 of the records.
The only difference is the additional character ''101%'' versus ''10%''.
Offline, it returns what I expect.
Thanks in advance.
I我必须询问您是否使用''%'作为通配符。如果您是 -
Access不支持%作为通配符。这将是一个Sql Server
通配符。需要使用*进行访问。如果这不是你的情况,那么
无视这个回复。
Rich
***发送来自开发人员指南 http://www.developersdex.com ***
不要只是参加USENET ......获得奖励!
I''m must inquiring if you are using ''%'' as a wildcard. If you are -
Access does not support % as a wildcard. That would be a Sql Server
wildcard. Need to use * for Access. If this is not your case, then
disregard this reply.
Rich
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
我试过两个并得到了相同的结果:
这个没有返回结果:
SELECT PN,Qty From Inventory Where PN Like''SSW-101'& ''%''
,这和以前一样返回两个:
SELECT PN,Qty From Inventory Where PN Like''SSW-10'& ''%''
注意:只是为了踢,我使用了两侧的通配符,如:
SELECT PN,Qty From Inventory Where PN Like ''%101%''
...它返回了我预期的结果。
提前致谢。
兰迪
***通过开发人员指南 http:// www发送.developersdex.com ***
不要只是参加USENET ......获得奖励!
I tried both and got the same results:
This did not return results:
SELECT PN, Qty From Inventory Where PN Like ''SSW-101'' & ''%''
and this returned two as before:
SELECT PN, Qty From Inventory Where PN Like ''SSW-10'' & ''%''
Note: just for kicks, I used the wildcard on both sides as in:
SELECT PN, Qty From Inventory Where PN Like ''%101%''
... and it returned the results I expected.
Thanks in advance.
Randy
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!
这篇关于在ASP中查询Access的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!