我刚学sql 现在在vb中 调用sql 语句 有问题不知道怎么写
有一个变量 x
现要查询 table 中 某个字段值 等于 x 的记录
select * from table where 条件该怎么写??
如果 变量是 字符型 怎么办 数值型又怎么办 (两者是不是不同)
我这样写的
.open "select * from table where 字段1名=x"
运行时有错误
有一个变量 x
现要查询 table 中 某个字段值 等于 x 的记录
select * from table where 条件该怎么写??
如果 变量是 字符型 怎么办 数值型又怎么办 (两者是不是不同)
我这样写的
.open "select * from table where 字段1名=x"
运行时有错误
select * from table where 字段1名='x'
.open sql
strSqlCmd="select * from table where 字段1名='" & x & "'"
"
"& x &" 才能正确传值
即.open "select * from table1 where 字段1名=" & x & " "或是字符型的,是应该为.open "select * from table1 where 字段1名='" & x & "' "