sql语句提示语句未结束

来源:百度知道 编辑:UC知道 时间:2024/06/27 05:14:49
HeightMin=1

sql="select * from love_user where (Height > "&HeightMin&" and Height <250)"
提示我语句未结束,给HeightMin换个别的变量名就行,比如换成strHeightMin就可以,换成HeightMinA或者HAeightMin就不行了,不知道sql语句里对变量使用有什么要求
不是因为HeightMin数据类型的问题,因为我换了个变量名strHeightMin之后就好使了。
strHeightMin=1

sql="select * from love_user where (Height > "&strHeightMin&" and Height <250)"
这样就好使。

&He 是有意义的,好像表示点啥,比如小数点啥的吧

所以,我们不得不用空格把他们隔开

sql="select * from love_user where (Height > " & HeightMin & " and Height <250)"

既然你定义了HeightMin=1
那你还不如直接把&HeightMin&换成1

HeightMin=1

sql="select * from love_user where Height > 1and Height <250"
where 条件语句后面不用括号

cstr(cint(HeightMin))