请援救
rs1 = New ADODB.Recordset
strsql = "select * from new where 车牌号= " & Me.TextBox1 & " "
提示:没有为类型“String”和“System.Windows.Forms.TextBox”定义运算符“&”。
[解决办法]
这样试试
strsql = "select * from [new] where 车牌号= ' " & Me.TextBox1.text & " ' "
[解决办法]
其实只是拼接的连接串有问题。
你的“车牌号”是一个字符串,要用单引号或双引号连接起来(用什么符号得看你用的是什么数据库,ACCESS、SQL SERVER和ORACLE关于字符串的引用定义不完全相同。)
strsql = "select * from new where 车牌号= " & Me.TextBox1 & " "应该修改为:
1) strsql = "select * from new where 车牌号= " & " ' " & Me.TextBox1 & " ' "
或:
2) strsql = "select * from new where 车牌号= " & " " " " & Me.TextBox1 & " " " "
--在VB里,四个双引号可以拼接为一个双引号。
[解决办法]
strsql = "select * from [new] where 车牌号= ' " & Me.TextBox1.text & " ' "
这才是正解...
[解决办法]
strsql = "select * from new where 车牌号= ' " & Me.TextBox1.text & " ' "