001如果是变量的话"select * from biao where id='" & 001 & "'" 如果不是的话"select * from biao where id='001'"
001是不合法的变量,不能用它来赋值吧?UPUP
"select * from biao where id=98"
我来检个便宜~总结一下~("select * from biao where id='" & "001" & "'") 这样看很清楚啊 select * from biao where id='001';001显然是个字符常量 而且001不符合变量命名标准 ,所以不可能是变量--------------------- 赶紧结了吧~大伙等分呢~~
湊湊數.很同意 pp 的觀點,你可以給回答問題的人多分, up 的給少分,這樣可以增加回答問題的積極性
id="001" set rs = cn.Execute("select * from biao where id=" & id & "")
id=001 set rs = cn.Execute("select * from biao where id=" + id + "")
001是非法的变量名。dim sqlStr as string dim idStr as stringsqlstr="select * from biao where id='001'"等同于:idstr="001" sqlstr="select * from biao where id='" & idstr & "'"
天…… 这题一看就知道 001 是字符串,还有这么多人说他是非法变量名,我倒 本来就是很简单的问题 如同VB里的DIM A AS INTEGER A=“001”如同上式,你们就看不出错在那么??? 那有把字符型的变量赋值给数值型变量的 ("select * from biao where id='" & "001" & "'")里ID一般是数值型字段(我不信有那本书或帮助是把它当其他类型的),难道可以用字符型赋值给它!!!
dim strID as stringid="001" set rs = cn.Execute("select * from biao where id='" & id & "'")
dim strid as string strin="001" set rs = cn.Execute("select * from biao where id='" & strid & "'")
答案是
SQL里数值型的字段不能用字符型来比较
所有数值型的字段 都不能用' 来括起来楼主,如果你都要求有50个人来回答你的帖子,请找点有意义的题目
你真要求要50人来回帖,建议你到灌水乐园
如果不是的话"select * from biao where id='001'"
这样看很清楚啊
select * from biao where id='001';001显然是个字符常量
而且001不符合变量命名标准 ,所以不可能是变量---------------------
赶紧结了吧~大伙等分呢~~
set rs = cn.Execute("select * from biao where id=" & id & "")
set rs = cn.Execute("select * from biao where id=" + id + "")
dim idStr as stringsqlstr="select * from biao where id='001'"等同于:idstr="001"
sqlstr="select * from biao where id='" & idstr & "'"
这题一看就知道 001 是字符串,还有这么多人说他是非法变量名,我倒
本来就是很简单的问题
如同VB里的DIM A AS INTEGER
A=“001”如同上式,你们就看不出错在那么???
那有把字符型的变量赋值给数值型变量的
("select * from biao where id='" & "001" & "'")里ID一般是数值型字段(我不信有那本书或帮助是把它当其他类型的),难道可以用字符型赋值给它!!!
set rs = cn.Execute("select * from biao where id='" & id & "'")
strin="001"
set rs = cn.Execute("select * from biao where id='" & strid & "'")