首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

form的post后传递过去的参数接收不到,是咋回事

2012-02-20 
form的post后传递过去的参数接收不到,是怎么回事?我用两个用户表,一个是动网论坛的,一个是自己的,现在能实

form的post后传递过去的参数接收不到,是怎么回事?
我用两个用户表,一个是动网论坛的,一个是自己的,现在能实现在数据同步增加,也就是说从自己的注册系统注册的时候能往论坛的用户表里写入同样的帐号和密码等信息,现在有个问题,就是我在修改这些注册信息的时候想同时修改论坛用户表里该用户的信息时总是出错,提示说:
ADODB.Recordset   错误   '800a0bb9 '  

变量或者类型不正确,或者不在可以接受的范围之内,要不就是与其他数据冲突。  

/User/Info_Save.asp,行105  
信息修改页部分代码:
<form   name= "form1 "   method= "post "   action= "Info_Save.asp?Type=Normal&Id= <%=Id%> "   onSubmit= "return   CheckAdd(this) ">    
<TR   bgColor=#f1f1f1>
        <TD   width= "30% "   height=25> 用户名: </TD>
        <TD   width= "80% "> <input   name= "UserName "   type= "text "   id= "UserName "   value= " <%=Rs( "UserName ")%> "   size= "30 "   maxlength= "20 "   readonly= "true ">
            <span   class= "style1 ">         *  
            <input   name= "Type "   type= "hidden "   id= "Type "   value= "Normal ">
            </span>         </TD>
    </TR>
...
    <TR>
        <TD   height= "25 "   bgcolor= "#f1f1f1 "> &nbsp;         </TD>
        <TD   height= "25 "   bgcolor= "#f1f1f1 "> <span   class= "tdbg ">
            <input   name= "Submit "   type= "submit "   class= "button01-out "   value= "确     定 ">
            <input   name= "Submit2 "   type= "reset "   class= "button01-out "   value= "还     原 ">
        </span> </TD>
    </TR>
</form>
</TABLE>
处理页Info_Save.asp相关代码如下:
<!--#include   file= "../bbs/Conn.asp "   -->
<!--#include   file= "../bbs/inc/const.asp "-->
<!--#include   file= "../bbs/inc/chkinput.asp "-->
<!--#include   file= "Conn.asp "   -->
<!--#include   file= "../Inc/Config.asp "   -->
<!--#include   file= "Inc/Session.asp "   -->
<!--#include   file= "../Inc/Char.asp "   -->
<!--#include   file= "../Inc/md5.asp "   -->
<!--#include   file= "Inc/CheckLevel.asp "   -->
<%
Sub   SaveInfo()
        If   ChkPost=False   Then
      Response.Write( " <script> alert( '对不起,请在正确位置注册!\n\n   排除异站提交! ');window.history.back(); </script> ")
              Response.End
        End   If
        Dim   UserId,Pwd,Pwd1,Question,Answer,Email
        UserId=Trim(Request( "Id "))
        Pwd=Trim(Request( "PassWord "))
        Pwd1=Trim(Request( "PassWord1 "))


Email=Trim(Request( "Email "))
Question=Trim(Request( "Question "))
Answer=Trim(Request( "Answer "))
Dim   SQLin
        SQLin=Insql(UserId,1)
        If   SQLin= "True "   Then
              Response.Write( " <script> alert( '对不起!提交页面有错误。\n\n请你不要非法操作! ');window.history.back(); </script> ")
              Response.End
        End   If
UserId=Clng(UserId)
        If   CheckEmail(Email)=False   Then
      Response.Write( " <script> alert( 'Email输入错误!请按照正确的地址。 ');window.history.back(); </script> ")
              Response.End
End   If

        Dim   Sql,Rs
        Set   Rs=Server.CreateObject( "ADODB.RecordSet ")
                Sql= "Select   Top   1   *   From   BY_User   Where   Id= "&UserId
                Rs.Open   Sql,Connxyc,1,3
Rs( "Email ")=Request.Form( "Email ")
Rs( "Sex ")=Request.Form( "Sex ")
        Dim   Tel,QQ,Age,Fax,Province,Zip,Adress,RealName,Other
Tel=Request.Form( "Tel ")
QQ=Request.Form( "QQ ")
Age=Request.Form( "Age ")
Fax=Request.Form( "Fax ")
Province=Request.Form( "Province ")
Zip=Request.Form( "Zip ")
Adress=Request.Form( "Address ")
RealName=Request.Form( "RealName ")
other=Request.Form( "Info ")
IF   tel= " "   or   Isnull(tel)   THEN   tel=0
IF   QQ= " "   or   Isnull(qq)   Then   QQ=0
If   Age= " "   or   isnull(Age)   or   Isnumeric(Age)= "False "   then   Age=18
If   Province= " "   or   isnull(Province)   then   Province= "山东 "
If   Fax= " "   or   isnull(Fax)   then   fax=0
If   zip= " "   or   isnull(zip)   or   isnumeric(zip)= "False "   then   zip=0
If   adress= " "   or   isnull(Adress)   then   adress= "   "
If   RealName= " "   or   isnull(RealName)   then   Realname= "   "
if   other= " "   or   isnull(Other)   then   other= "   "
Rs( "RealName ")=RealName
Rs( "Tel ")=Tel
Rs( "QQ ")=QQ
        Rs( "Age ")=Age
Rs( "Fax ")=Fax
Rs( "Province ")=Province
Rs( "Address ")=Adress
Rs( "Zip ")=Zip
Rs( "Other ")=Other
Rs( "LastLoginTime ")=Now()
Rs( "LastIp ")=request.ServerVariables( "Remote_Addr ")
Rs( "LoginTimes ")=0
        Rs( "AddTime ")=Now()
        Rs.Update
session( "UserName ")=Rs( "UserName ")
        Rs.Close:Set   Rs=Nothing

        Dim   Sql1,Rs1,UserName
UserName=session( "UserName ")
        Set   Rs1=Server.CreateObject( "ADODB.RecordSet ")


                Sql1= "Select   Top   1   *   From   Dv_User   Where   UserName= ' "&UserName& " ' "
                Rs1.Open   Sql1,Conn,1,3
Rs1( "UserEmail ")=Request.Form( "Email ")
Rs1( "UserSex ")=Request.Form( "Sex ")
Rs1( "UserMobile ")=Request.Form( "Mobile ")
        Rs1.Update
        Rs1.Close:Set   Rs1=Nothing
end   sub
%>

问题就出在Sql1= "Select   Top   1   *   From   Dv_User   Where   UserName= ' "&UserName& " ' "这一行,是我什么地方写得不对?

[解决办法]
既然你知道是这句不对。那就将这句输出看看啊。我怀疑可能你的username变量没有值。
[解决办法]
Rs.Open Sql,Connxyc,1,3
Rs1.Open Sql1,Conn,1,3
有两个adodb.connection? Connxyc、conn?
[解决办法]
Sql1= "Select Top 1 * From Dv_User Where UserName= ' "&UserName& " ' "
怎么总是有人喜欢“top 1”,这是有意外情况的。用absoluteposition或find来定位记录不是更自然吗。还有就是&的前后要用空格。
[解决办法]
Rs.Update
session( "UserName ")=Rs( "UserName ")
更新后在赋值好象是不行的,你用
response.write "session( "UserName ") "
response.end()
看看有没有值输出

热点排行