我的asp登陆程序错在哪?
<!--#include file="func/func.asp"-->
<%
idname=request("idname")
password=request("password")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("ffsdb.mdb")
sql="select idname,password from login where idname="&idname
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,2 '///这报错
if password <> rs("password") then
popup "您输入的密码不正确!","enter.htm"
end if
session("passed")=true
session("idname")=idname
rs.close
set rs=nothing
conn.close
set conn=nothing
response.redirect "index.asp"
%>
执行后报错:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e10'
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/enter.asp, 行11
请问怎么改?请指点
参考答案:SQL语句错误,idname应该是字符串型数据吧
sql="select idname,password from login where idname="&idname
应该写成
sql="select idname,password from login where idname='"&idname&"'"