我的sql语句写错了吗?

jerry0608 2003-11-11 10:34:54
偶做了一个小小的程序,使用的是asp+access。
这句sql语句是用于记录修改时判断除了这条记录本身外,是否还存在其他相同的MAC,但是好象不起作用,我写错了吗?该怎么写?

"select * from computer where mac='"&mac&"'and id<>"&id&""
...全文
74 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
jerry0608 2003-11-13
  • 打赏
  • 举报
回复
也不是空格的缘故,我再看看到底是怎么回事吧。
谢谢各位的帮助,分不多,小妹这厢有礼了。
blue_butterfly 2003-11-12
  • 打赏
  • 举报
回复
select * from computer where mac=LTRIM(RTRIM('"&mac&"')) and id<>LTRIM(RTRIM('"&id&"'))

试试,可能是空格的缘故
cqlxm 2003-11-12
  • 打赏
  • 举报
回复
sql="select * from computer where mac='" & mac & "' and id<>" & id
zhanghao5188 2003-11-12
  • 打赏
  • 举报
回复
select * from computer where mac='"&mac&"' and id<>"&id

cs828 2003-11-11
  • 打赏
  • 举报
回复
试试这样,好使
"select * from computer where mac='"&mac&"'and id<>"&cint(id)
sexdoctor 2003-11-11
  • 打赏
  • 举报
回复
"select * from computer where mac="&"mac" & "and id<>"&"id"
这样吧!
sherrywear 2003-11-11
  • 打赏
  • 举报
回复
mac和id的数据类型?
数字的话不用加'',字符型的话一定要加''
wahdee 2003-11-11
  • 打赏
  • 举报
回复
"select * from computer where mac='"&mac&"'and id<>'"&id&"'"
xiaobird1 2003-11-11
  • 打赏
  • 举报
回复
"select * from computer where mac='"&mac&"' and id<>"&id
xeimm 2003-11-11
  • 打赏
  • 举报
回复
"select * from computer where mac='"&mac&"' and id<>"&id
cdsun 2003-11-11
  • 打赏
  • 举报
回复
ids=trim(request.form("ID"))
"select * from computer where mac='"&+mac+&"'and id<>"&ids
jerry0608 2003-11-11
  • 打赏
  • 举报
回复
偶试过了,以上方法都不行,有没有更好的办法?
字段种类偶没有弄错,mac字符型,id是access自己的,整数。

28,391

社区成员

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

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