sql语句在asp中的格式问题

来源:百度知道 编辑:UC知道 时间:2024/09/28 13:59:16
sql="select id,sender from message where incept='"&membername&"' and flag=0 and issend=1 and id>"&cstr(request("id")&" order by sendtime")

"&cstr(request("id")&" 不是该写成
'"&cstr(request("id")&"'么
我的意思是,作为字符串变量在sql中不都要写成
'字符串(变量或常量)'这样的形式么,这里cstr()为什么两端没有''
原式是这样的,刚才括号弄错了
sql="select id,sender from message where incept='"&membername&"' and flag=0 and issend=1 and id>"&cstr(request("id"))&" order by sendtime"

禁止不懂装懂的人放p

字段为数字类型的(如 int decimal float)不用单引号

id 应该定义成了整型(int)
所以不用单引号

因为用了连接符了,&

估计id 在数据库里面是个数字吧?