男生穿增高鞋垫的坏处:Sql Server 查询数值变量

来源:百度文库 编辑:高校问答 时间:2024/05/01 21:52:03
用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