写了一段ASP,出现以下错误,是什么意思

ymxl76 2003-07-25 08:25:20
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<%strname=request("name")%>
<%straddress=request("address")%>
<%strdate_y=request("date_y")%>
<%strdate_m=request("date_m")%>
<%strdate_d=request("date_d")%>
<%strdate=strdate_y&"-"&strdate_m&"-"&strdate_d%>
<%strusername=request("username")%>
<%strpassword=request("password")%>
<body>
<%
Set conn = Server.CreateObject("ADODB.Connection")
'ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=mm.mdb;DefaultDir=" & Server.MapPath(".") & ";DriverId=25;FIL=MS Access;MaxBufferSize=512;PageTimeout=5"
ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&server.MapPath ("mm.mdb")
conn.Open ConnectionString
Response.Write("ConnectionString:"&ConnectionString&"<br>")
Response.Write("Username:"&strusername&"<br>")
Response.Write("Password:"&strpassword&"<br>")
if strusername<>"" and strpassword<>"" then
Set rs = Server.CreateObject("ADODB.Recordset")
SqlStr = "SELECT * FROM user where username='"&strusername&"'"
rs.Open SqlStr,conn,3,3

if rs.recordcount=1 then
response.write "你的用户名已经存在!请换用户名<br>"
response.write "<a href=javascript:window.history.back()>返回</a>"
elseif rs.recordcount=0 then
rs.Close
Sql = "insert into user(name,address,birthday,username,password) values('"&strname&"','"&straddress&"','"&strdate&"','"&strusername&"','"&strpassword&"')"
Response.Write sql
conn.Execute (sql)
response.write "已成功录入!!"
end if
end if

%>


</body>

</html>

以下是错误信息:我哪里少了End?

Microsoft VBScript 编译器错误 错误 '800a03f6'

缺少 'End'

/iisHelp/common/500-100.asp,行242

Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005'

[Microsoft][ODBC Microsoft Access Driver] 操作必须使用一个可更新的查询。

/HuaChun/addnew.asp,行38
...全文
28 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaye 2003-07-29
  • 打赏
  • 举报
回复
我不知道elseif能不能通,所以我只写 else if
xiaoyuehen 2003-07-25
  • 打赏
  • 举报
回复
请检查你要更新的数据库所在的目录,看是否有修改的权限...目录的属性==>安全 栏..看下方权限栏左边是否有全部勾选..

多数情况是因为目录为NTFS格式,在移动或者其他操作目录的时候,使权限失效了..

wind321 2003-07-25
  • 打赏
  • 举报
回复
注意if的语法结构
if (条件) then
....
else if (条件) then
...
end if
end if
yudoggy 2003-07-25
  • 打赏
  • 举报
回复
第38行是 conn.Execute (sql)
说明是执行SQL语句的时候出错了
check一下这段SQL语句:
Sql = "insert into user(name,address,birthday,username,password) values('"&strname&"','"&straddress&"','"&strdate&"','"&strusername&"','"&strpassword&"')"
yudoggy 2003-07-25
  • 打赏
  • 举报
回复
顺便说一下,elseif是正确的写法,自己做一下试验就知道了
yudoggy 2003-07-25
  • 打赏
  • 举报
回复
个人认为真正的错误在这里:
[Microsoft][ODBC Microsoft Access Driver] 操作必须使用一个可更新的查询。
delphine 2003-07-25
  • 打赏
  • 举报
回复
少了一个end if
shanhe 2003-07-25
  • 打赏
  • 举报
回复
老兄,把代码规整一下不就看出少了一个end if.

这样的问题,以后不要贴出来了。
dzqsuper 2003-07-25
  • 打赏
  • 举报
回复
那里少了一个end if 哦,根本没有的事吗

只是你的那些个变量没有close吧
xiaye 2003-07-25
  • 打赏
  • 举报
回复
if strusername<>"" and strpassword<>"" then
Set rs = Server.CreateObject("ADODB.Recordset")
SqlStr = "SELECT * FROM user where username='"&strusername&"'"
rs.Open SqlStr,conn,3,3

if rs.recordcount=1 then
response.write "你的用户名已经存在!请换用户名<br>"
response.write "<a href=javascript:window.history.back()>返回</a>"
else if rs.recordcount=0 then
rs.Close
Sql = "insert into user(name,address,birthday,username,password) values('"&strname&"','"&straddress&"','"&strdate&"','"&strusername&"','"&strpassword&"')"
Response.Write sql
conn.Execute (sql)
response.write "已成功录入!!"
end if
end if

的确少一个,在最后再再增加一个end if就可以了.你中间的elseif改为: else if
guxiaobo1982 2003-07-25
  • 打赏
  • 举报
回复
有调试工具的啊

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧