超级郁闷,ACCESS中备注型用LIKE '%香港%',记录是存在的,但就是查不出结果。

zhongwancheng 2004-04-07 09:25:19
超级郁闷,ACCESS中备注型用LIKE '%香港%',记录是存在的,但就是查不出结果。
难道真的是ACCESS的BUG吗?救命啊!
还有什么方法改变吗??
...全文
132 25 打赏 收藏 转发到动态 举报
写回复
用AI写文章
25 条回复
切换为时间正序
请发表友善的回复…
发表回复
歪歪 2004-04-07
  • 打赏
  • 举报
回复
up
caiyi000 2004-04-07
  • 打赏
  • 举报
回复
select * from customer_email where email like '%"&request("email")&"%'
lsaturn 2004-04-07
  • 打赏
  • 举报
回复
+是可以的,dw生成的代码全是这样的
caiyi000 2004-04-07
  • 打赏
  • 举报
回复
ACCESS一样可以使用%

比如
ddd=request("email")
select * from customer_email where email like ddd
eduxh 2004-04-07
  • 打赏
  • 举报
回复
sql=sql &" and customer_email like '%"& email4 &"%'"
loveweb 2004-04-07
  • 打赏
  • 举报
回复
UP
xdk 2004-04-07
  • 打赏
  • 举报
回复
1\ ACCESS中LIKE用* 而不是% 改为'*香港*'
2\ 连接符将+改为&
whf21012179 2004-04-07
  • 打赏
  • 举报
回复
你把rs释放了,并且把“+”换成“&”试一试 如果不行,我们可以在讨论
qwater 2004-04-07
  • 打赏
  • 举报
回复
ACCESS中LIKE用* 而不是%
'*香港*'
GoodyeahApple 2004-04-07
  • 打赏
  • 举报
回复
先用response.write sql 查看一下最终sql是怎样。
whghwujx 2004-04-07
  • 打赏
  • 举报
回复
青楼主注意两个问题
1、字段的类型 字段的类型不同,引号也不能一样,主要在双引号和单引号
2、记录的准确 楼主检查一下在数据库中的“香港”有无空格
银狐被占用 2004-04-07
  • 打赏
  • 举报
回复
你换个连接符试试。用&。
cqhz 2004-04-07
  • 打赏
  • 举报
回复
access中不用+连接,是用&的
sql=sql&" and customer_email like '%"&email4&"%'"
ttkkyy 2004-04-07
  • 打赏
  • 举报
回复
asp中连接符是&吧

sql=sql+" and customer_email like '%"&email4&"%'"
应改为

sql=sql&" and customer_email like '%"&email4&"%'"
zhongwancheng 2004-04-07
  • 打赏
  • 举报
回复
ACCESS我不熟悉!真的没有办法解决吗?
zhongwancheng 2004-04-07
  • 打赏
  • 举报
回复
<%
dim sql
dim email1
dim email2
dim email3
dim email4
sql="SELECT e.ID FROM customer_email INNER JOIN e ON customer_email.customer_id = e.ID WHERE "
email1=request.form("email1")
email2=request.form("email2")
email3=request.form("email3")
email4=request.form("email4")
if email1<>"" then
sql=sql+" customer_email like '%"&trim(email1)&"%'"
end if
if email2<>"" then
if len(sql)=91 then
sql=sql+" customer_email like '*"&email2&"*'"
else
sql=sql+" and customer_email like '*"&email2&"*'"
end if
end if
if email3<>"" then
if len(sql)=91 then
sql=sql+" customer_email like '*"&email3&"*'"
else
sql=sql+" and customer_email like '*"&email3&"*'"
end if
end if

if email4<>"" then
if len(sql)=91 then
sql=sql+" customer_email like '%"&email4&"%'"
else
sql=sql+" and customer_email like '%"&email4&"%'"
end if

end if
sql=sql+" GROUP BY e.ID "
set rs=server.CreateObject("ADODB.RecordSet")
rs.open sql,conn,1,3
if rs.eof then

response.write "<script>alert('没有你所查的资料!\n\n返回!');history.back();"
response.write "</script>"
response.end()
end if
应该没有问题啊,我导入到SQL SERVER 里面在用这个语句是可以的啊

pongid2353345 2004-04-07
  • 打赏
  • 举报
回复
把代码贴出来!
leisen 2004-04-07
  • 打赏
  • 举报
回复
up
sfply 2004-04-07
  • 打赏
  • 举报
回复
复人: xieyj(Free Fish) ( ) 信誉:103 2004-04-07 09:28:00 得分:0


如果存在肯定是可以查的出来的,你看一下是不是文字有误


ttkkyy 2004-04-07
  • 打赏
  • 举报
回复
差个反引号

sql="·····like '%"& aa &"%'"
加载更多回复(5)

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧