asp代码问题,请老师指点(请问以下代码正确吗)

来源:百度知道 编辑:UC知道 时间:2024/05/15 07:57:26
<%
a="牡丹"
b=123456
exec="select * from one where name='"+a+"'and tel="+b
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,1
%>
错误类型:
Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: '[string: "select * from one wh"]'
/reg.asp, 第 18 行

exec="select * from one where name='"+a+"'and tel="+b
中的+换成&,即:
exec="select * from one where name='"&a&"'and tel="&b(前提tel是数值型的)
exec="select * from one where name='"&a&"'and tel='"&b&"'"(前提tel是文本型的)

是不是中间少个 空格
name='"+a+"'and
哦,你是写.net写多了吧,asp的连接符是&不是+