1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

程序出错,快帮帮我!

本帖由 leehui19832006-03-14 发布。版面名称:后端开发

  1. leehui1983

    leehui1983 New Member

    注册:
    2006-02-26
    帖子:
    130
    赞:
    0
    Microsoft JET Database Engine (0x80040E14)
    FROM 子句语法错误。
    /小站/check.asp, 第 11 行
    <!--#include file="conn.asp"-->
    <%
    dim username,userpass,sql
    username=request.Form("uname")
    userpass=request.Form("upwd")
    if username="" or userpass="" then
    response.Write"<script>alert('不能为空!');history.back();</script>"
    else
    set rs=server.CreateObject("ADODB.Recordset")
    sql="select * from user where username='"&username&"'"
    rs.open sql,conn,1,1
    if rs.bof and rs.eof then
    rs.addnew
    rs("username")=username
    rs("userpwd")=userpass
    rs("time")=now()
    rs.update
    rs.close
    set conn=nothing
    response.Redirect("userwrite.asp?id="&rs("id")&"")
    else
    response.Write"<script>alert('该用户已存在!');history.back();</script>"
    end if
    end if
    %>
     
  2. Tameway

    Tameway New Member

    注册:
    2005-09-06
    帖子:
    1,286
    赞:
    8
    rs.bof and rs.eof

    ???

    or
     
  3. leehui1983

    leehui1983 New Member

    注册:
    2006-02-26
    帖子:
    130
    赞:
    0
    我靠,真是写晕了我!多谢!
     
  4. Ulysses

    Ulysses New Member

    注册:
    2006-02-05
    帖子:
    10,018
    赞:
    16
    if rs.bof and rs.eof then

    这个表明表中是空的,针对 rs.open sql,conn,1,1,只要满足 rs.eof 就可以了。

    错误提示信息是 FROM 字句语法错误

    select * from user where username='"&username&"'"

    不排除 user 为关键字的可能。

    试试看:

    select * from [user] where username='"&username&"'"
     
  5. leehui1983

    leehui1983 New Member

    注册:
    2006-02-26
    帖子:
    130
    赞:
    0