惠州发展前景怎么样:Sql Server 查询数值变量

来源:百度文库 编辑:神马品牌网 时间:2024/04/27 21:47:55
用vb写的select语句怎么查带变量的数值查询?
查询语句如下:
dim idInt as integer
idint =1
ado.open "Select * From A Where a.id = "&(idInt)&"",cnn,1,1
提示错误13,数据类型不匹配。
a.id是一个主键,int自动编号的一个主键。
"Select * From A Where a.id = " & CStr(idInt)
我试过了,出错。

sql="select * from a where id=" &idint
ado.open sql,cnn,1,1

ID是整型,在SQL语句里面的=后面不能有空格

ado.open "Select * From A Where a.id = " & CStr(idInt) ,cnn,1,1