大家帮我看看这个程序错在哪里,如何修改?谢谢!!
先给出运行结果:Microsoft JET Database Engine 错误 '80040e07'
标准表达式中数据类型不匹配。
/123456789/dlchuli.asp,行 21
<% response.Buffer=true %>
<html>
<head>
<title>登陆处理</title>
</head>
<body>
<%
n1=trim(request.Form("name"))
n2=trim(request.Form("word"))
if n1="" or n2="" then
response.write"<p align=center>出错提示:用户名、密码不能为空!</p>"
response.write"<p align=center><a href=index.asp>返回重新登陆</a></p>"
response.end
end if
dim filepath,cn1,sq1,rs
filepath=server.MapPath("wangzhan.mdb")
set cn1=server.createobject("adodb.connection")
cn1.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&filepath&";Persist Security Info=False"
sq1="select * from yonghu where 用户名='"&n1&"'and 密码='"&n2&"'"
set rs=server.createobject("adodb.recordset")
rs.open sq1,cn1,1,1
if cn1.eof then
response.write"<p align=center>出错提示:用户名不存在或用户名、密码不正确!</p>"
response.write"<p align=center><a href=index.asp>返回重新登陆</a></p>"
else
response.write"<p align=center>登陆成功!</a></p><br><br>"
response.write"<p align=center><a href=yonghu.asp>点击这里进入用户页</a></p>"
cn1.close
set cn1=nothing
end if
%>
</body>
</html>
[[it] 本帖最后由 过傻过天真 于 2008-7-16 23:13 编辑 [/it]]
and 前面要空一格
用户名='"&n1&"' and 还是不行 cn1.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&filepath&";
你这里多了个"&filepath"后面多了一个",你试试看这个删了.
还有一点就是数据库里的表名最好用英文的,用中文不大好! [quote][bo][un]kgdipbyve[/un] 在 2008-7-16 17:11 的发言:[/bo]
cn1.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&filepath&";
你这里多了个"&filepath"后面多了一个",你试试看这个删了.
还有一点就是数据库里的表名最好用英文的,用中文不大好! [/quote]
这应该没问题.那个双引号是和后面的内容连在一起的 是这一句有问题
rs.open sq1,cn1,1,1
不然就是这一句了
sq1="select * from yonghu where 用户名='"&n1&"'and 密码='"&n2&"'" 21行是这个
set rs=server.createobject("adodb.recordset") end if后面的空行是我后来为了方便修改加上去的,发贴的时候忘记删除,真抱歉 sq1="select * from yonghu where 用户名='"&n1&"' and 密码='"&n2&"'" [quote][bo][un]anlige[/un] 在 2008-7-17 03:55 的发言:[/bo]
sq1="select * from yonghu where 用户名='"&n1&"' and 密码='"&n2&"'" [/quote]
Microsoft JET Database Engine 错误 '80040e07'
标准表达式中数据类型不匹配。
/123456789/dlchuli.asp,行 21 字段最好用英文来命名,能减少莫名其妙的错误。 最讨厌看不标出错行的代码。 [quote][bo][un]multiple1902[/un] 在 2008-7-17 20:45 的发言:[/bo]
最讨厌看不标出错行的代码。 [/quote]
真是抱歉啊,是这一行啦: rs.open sq1,cn1,1,1 把中文字段名都改成英文的试试 用英文也不行
Microsoft JET Database Engine 错误 '80040e07'
标准表达式中数据类型不匹配。
/123456789/dlchuli.asp,行 21 那俩字段是什么数据类型? [quote][bo][un]multiple1902[/un] 在 2008-7-18 16:21 的发言:[/bo]
那俩字段是什么数据类型? [/quote]
用户名是文本,密码是数字 知道数字字段不需要单引号吗?
比如,这里有3个苹果,而不是这里有'3'个苹果。这个3在数轴上有对应点。
你叫'小明',这个'小明'是字符串,在数轴上没有对应点的字符串。 我改成这样sq1="select * from yonghu where user='"&n1&"' and mima="&n2
现在这一行好象可以了,不过第22行出错:
ADODB.Connection 错误 '800a0bb9'
参数类型不正确,或不在可以接受的范围之内,或与其他参数冲突。
/123456789/dlchuli.asp,行 22
第22行: if cn1.eof then 我估计是这样:Connection对象(就是那个cn1)没有eof这个属性,因为有了也没意义。有eof的是rs。
页:
[1]
2
