我的asp登陆程序错在哪?

来源:百度知道 编辑:UC知道 时间:2024/06/11 15:25:12
<!--#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][ODB

SQL语句错误,idname应该是字符串型数据吧
sql="select idname,password from login where idname="&idname
应该写成
sql="select idname,password from login where idname='"&idname&"'"

如果没有接收到idname的话.肯定会报错.
因为到时会生成一个错误的sql出来!

你用
response.write(""&sql&"")
response.end()
看看这句语句,自己分析错误,一楼应该对

同意hongfeng8868 的