| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 477 人关注过本帖
标题:不知道这段代码那里错了,请大侠们帮忙!~~
只看楼主 加入收藏
yjq110
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-5-6
收藏
 问题点数:0 回复次数:4 
不知道这段代码那里错了,请大侠们帮忙!~~
我做一个班级网站的注册程序,可是忘数据库填写数据总填不上。不知道那出问题了!!!请帮忙解决!!!3Q
<%
   set rs=server.CreateObject("adodb.recordset")
    sql="select * from user where username='"&trim(request("username"))&"'"
    rs.open sql,secondconn,3,3
    if not rs.eof then
     errmsg=errmsg+"<br><li>用户名"+trim(request("username"))+"已被别人注册"
     founderr=true
     end if
     rs.close
     set rs=nothing
    set rs1=server.CreateObject("adodb.recordset")
     sql1="select*from user where nickname='"&trim(request("nickname"))&"'"
     rs1.open sql1,secondconn,3,3
     if not rs.eof then
     errmsg=errmsg+"<br><li>昵称"+trim(request("nickname"))+"已被别人注册"
     founderr=true
     end if
     rs1.close
     set rs1=nothing
     set rs2=server.CreateObject("adodb.recordset")
     sql2="select*from user where turename='"&trim(request("turename"))&"'"
     rs2.open sql2,secondconn,3,3
     if not rs.eof then
     errmsg=errmsg+"<br><li>真实姓名"+trim(request("turename"))+"已被别人注册"
     founderr=true
     end if
     rs2.close
     set rs2=nothing
     if trim(request("birthyear"))="" then
     birthyear=" "
     else
     birthyear=trim(request("birthyear"))
     end if
     if trim(request("birthmonth"))="" then
     birthmonth=" "
     else
     birthmonth=trim(request("birthmonth"))
     end if
     if trim(request("birthday"))="" then
     birthday=" "
     else
     birthday=trim(request("birthday"))
     end if
     if trim(request("mobile"))="" then
     mobile=" "
     else
     mobile=trim(request("mobile"))
     end if
     if trim(request("homeaddress"))="" then
     homeaddress=" "
     else
     homeaddress=trim(request("homeaddress"))
     end if
     if trim(request("homepostcode"))="" then
     homepostcode=" "
     else
     homepostcode=trim(request("homepostcode"))
     end if
     if trim(request("hometel"))="" then
     hometel=" "
     else
     hometel=trim(request("hometel"))
     end if
     if trim(request("companyaddress"))="" then
     companyaddress=" "
     else
     companyadress=trim(request("companyadress"))
     end if
     if trim(request("companypostcode"))="" then
     companypostcode=" "
     else
     companypostcode=trim(request("companypostcode"))
     end if
     if trim(request("companytel"))="" then
     companytel=" "
     else
     companytel=trim(request("companytel"))
     end if
     if trim(request("qq"))="" then
     qq=" "
     else
     qq=trim(request("qq"))
     end if
     if trim(request("homepage"))="" then
     homepage=" "
     else
     homepage=trim(request("homepage"))
     end if
     if trim(request("selfintro"))="" then
     selfintro="我非常懒,不想介绍啦!"
     else
     selfintro=trim(request("selfintro"))
     end if
     if trim(request("memo"))="" then
     memo=" "
     else
     memo=trim(request("memo"))
     end if
     if founderr=true then
       response.write errmsg
     else
     set rs1=server.CreateObject("adodb.recordset")
     sql1="select*from user where(userid is null)"
     rs1.open sql1,secondconn,3,3
     rs1.addnew
    
     rs1("username")=trim(request("username"))
     rs1("password")=trim(request("password"))
     rs1("nickname")=trim(request("nickname"))
     rs1("truename")=trim(request("truename"))
     rs1("email")=trim(request("email"))
     rs1("birthyear")=birthyear
     rs1("birthmonth")=birthmonth
     rs1("birthday")=birthday
     rs1("mobile")=mobile
     rs1("homeaddress")=homeaddress
     rs1("homepostcode")=homepostcode
     rs1("hometel")=hometel
     rs1("companyaddress")=companyaddress
     rs1("companypostcode")=companypostcode
     rs1("companytel")=companytel
     rs1("qq")=qq
     rs1("homepage")=homepage
     rs1("selfintro")=selfintro
     rs1("memo")=memo
     rs1("sex")=request("sex")
     rs1("regtime")=now()
     rs1("updatetime")=now()
     rs1("logincount")=0
     rs1("quanxian")="guest"
     rs1("checked")=false
     rs1.update
     rs1.close
      set rs1=nothing
      response.Write "恭喜恭喜,注册成功!"
      end if
    %>

[[it] 本帖最后由 yjq110 于 2008-5-6 22:20 编辑 [/it]]
搜索更多相关主题的帖子: 代码 
2008-05-06 22:11
yjq110
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-5-6
收藏
得分:0 
附带连接数据库代码
<%
dim secondconn
dim secondconnstr
on error resume next
secondconnstr="DBQ="+server.mappath("../mydatabase/class.mdb")+";defaultdir=;driver={microsoft access driver(*.mdb)};"
set secondconn=server.CreateObject("adodb.connection")
secondconn.open secondconnstr
%>
2008-05-06 22:23
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
<%
   set rs=server.CreateObject("adodb.recordset")
    sql="select * from [user] where username='"&trim(request("username"))&"'"
    rs.open sql,secondconn,3,3
    if not rs.eof then
     errmsg=errmsg+"<br><li>用户名"+trim(request("username"))+"已被别人注册"
     founderr=true
     end if
     rs.close
     set rs=nothing
    set rs1=server.CreateObject("adodb.recordset")
     sql1="select*from [user] where nickname='"&trim(request("nickname"))&"'"
     rs1.open sql1,conn,3,3
     if not rs1.eof then
     errmsg=errmsg+"<br><li>昵称"+trim(request("nickname"))+"已被别人注册"
     founderr=true
     end if
     rs1.close
     set rs1=nothing
     set rs2=server.CreateObject("adodb.recordset")
     sql2="select*from [user] where turename='"&trim(request("turename"))&"'"    '可能是拼写错误true写成ture了
     rs2.open sql2,conn,3,3
     if not rs2.eof then
     errmsg=errmsg+"<br><li>真实姓名"+trim(request("turename"))+"已被别人注册"
     founderr=true
     end if
     rs2.close
     set rs2=nothing
     if trim(request("birthyear"))="" then
     birthyear=" "
     else
     birthyear=trim(request("birthyear"))
     end if
     if trim(request("birthmonth"))="" then
     birthmonth=" "
     else
     birthmonth=trim(request("birthmonth"))
     end if
     if trim(request("birthday"))="" then
     birthday=" "
     else
     birthday=trim(request("birthday"))
     end if
     if trim(request("mobile"))="" then
     mobile=" "
     else
     mobile=trim(request("mobile"))
     end if
     if trim(request("homeaddress"))="" then
     homeaddress=" "
     else
     homeaddress=trim(request("homeaddress"))
     end if
     if trim(request("homepostcode"))="" then
     homepostcode=" "
     else
     homepostcode=trim(request("homepostcode"))
     end if
     if trim(request("hometel"))="" then
     hometel=" "
     else
     hometel=trim(request("hometel"))
     end if
     if trim(request("companyaddress"))="" then
     companyaddress=" "
     else
     companyadress=trim(request("companyadress"))
     end if
     if trim(request("companypostcode"))="" then
     companypostcode=" "
     else
     companypostcode=trim(request("companypostcode"))
     end if
     if trim(request("companytel"))="" then
     companytel=" "
     else
     companytel=trim(request("companytel"))
     end if
     if trim(request("qq"))="" then
     qq=" "
     else
     qq=trim(request("qq"))
     end if
     if trim(request("homepage"))="" then
     homepage=" "
     else
     homepage=trim(request("homepage"))
     end if
     if trim(request("selfintro"))="" then
     selfintro="我非常懒,不想介绍啦!"
     else
     selfintro=trim(request("selfintro"))
     end if
     if trim(request("memo"))="" then
     memo=" "
     else
     memo=trim(request("memo"))
     end if
     if founderr=true then
       response.write errmsg
     else
     set rs1=server.CreateObject("adodb.recordset")
     sql1="select * from [user] where(id is null)"
     rs1.open sql1,conn,3,3
     rs1.addnew
     
     rs1("username")=trim(request("username"))
     rs1("password")=trim(request("password"))
     rs1("nickname")=trim(request("nickname"))
     rs1("truename")=trim(request("truename"))
     rs1("email")=trim(request("email"))
     rs1("birthyear")=birthyear
     rs1("birthmonth")=birthmonth
     rs1("birthday")=birthday
     rs1("mobile")=mobile
     rs1("homeaddress")=homeaddress
     rs1("homepostcode")=homepostcode
     rs1("hometel")=hometel
     rs1("companyaddress")=companyaddress
     rs1("companypostcode")=companypostcode
     rs1("companytel")=companytel
     //rs1("qq")=qq
     //rs1("homepage")=homepage
     rs1("selfintro")=selfintro
     rs1("memo")=memo
     rs1("sex")=request("sex")
     rs1("regtime")=now()
     rs1("updatetime")=now()
     rs1("logincount")=0
     rs1("quanxian")="guest"
     rs1("checked")=false
     rs1.update
     rs1.close
      set rs1=nothing
      response.Write "恭喜恭喜,注册成功!"
      end if
    %>
2008-05-07 00:18
yjq110
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-5-6
收藏
得分:0 
谢谢  谢谢~~~ 拼错的还真不少。 真难~  我照着书做的,都弄成这样。5555555……
2008-05-07 08:00
yjq110
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2008-5-6
收藏
得分:0 
if not rs2.eof then
     errmsg=errmsg+"<br><li>真实姓名"+trim(request("truename"))+"已被别人注册"
     founderr=true
     end if
请问这几句是什么意思啊???
2008-05-07 08:17
快速回复:不知道这段代码那里错了,请大侠们帮忙!~~
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.044620 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved