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

asp登陸驗証系統問題 急死人的問題 100分求解決,该怎么解决

2012-03-25 
asp登陸驗証系統問題急死人的問題100分求解決錯誤提示:錯誤類型:ADODB.Recordset(0x800A0BB9)引數可能有類

asp登陸驗証系統問題 急死人的問題 100分求解決
錯誤提示:錯誤類型:
ADODB.Recordset   (0x800A0BB9)
引數可能有類型錯誤,或超過可接受的定義範圍,或與其他引數衝突。
/check1.asp,   line   40                              

下面標記好了40行的位置


問題困擾我一個月了,請幫忙解決啊,幫忙在電腦上調試     asp+sql

三個文件index1.asp     conn1.asp     check1.asp


瀏覽器類型:


index1.asp


<%
dim   rndnum,verifycode
randomize

do   while   len(rndnum) <4
num1=cstr(chr((57-48)*rnd+48))
rndnum=rndnum&   num1
loop
session( "verifycode ")=rndnum

%>
<html>
<head>
<meta   name= "GENERATOR "   content= "Microsoft   FrontPage   5.0 ">
<meta   name= "ProgId "   content= "FrontPage.Editor.Document ">
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 明日实业办公自动化系统 </title>


<style   type= "text/css ">
<!--
.style1   {
font-size:   16pt;
font-weight:   bold;
}
.style2   {font-size:   10pt}
.style3   {font-size:   16px}
-->
</style>
</head>
<body>
<table   width= "520 "   height= "264 "   border= "0 "   align= "center ">
    <tr>
        <td   height= "21 "   bgcolor= "#CCFFFF "> &nbsp; </td>
    </tr>
    <tr>
        <td   height= "75 "   bgcolor= "#FFFF66 ">     <div   align= "center "   class= "style1 ">
            <p> 辦   公   自   動   化   系   統 </p>
            <p   align= "right ">   <span   class= "style2 "> system   user   login   </span> </p>
        </div> </td>
    </tr>
    <tr>  
        <td   height= "62 "> <form     name= "form1 "   action= "check1.asp?action=login "   method= "POST ">
            <table   width= "518 "   height= "150 "   border= "0 ">
                <tr>
                    <td   colspan= "3 "> 登陸窗口: </td>
                    </tr>
                <tr>
                    <td   width= "60 "> &nbsp; </td>
                    <td   width= "73 "> 用戶名: </td>
                    <td   width= "371 "> <label>
                        <input   name= "admin_name "   type= "text "   id= "admin_name "     onFocus= "this.select(); "   onMouseOver= "this.style.background= '#EAEAEA '; "     onMouseOut= "this.style.background= 'FFFFFF ' ">


                    </label> </td>
                </tr>
                <tr>
                    <td> &nbsp; </td>
                    <td> 密碼   :   </td>
                    <td> <label>
                        <input   name= "admin_pass "   type= "password "   id= "admin_pass "   onFocus= "this.select(); "   onMouseOver= "this.style.background= 'EAEAEA '; "   onMouseOut= "this.style.background= 'FFFFFF ' ">
                    </label> </td>
                </tr>
                <tr>
                    <td> &nbsp; </td>
                    <td> 驗証碼: </td>
                    <td> <label>
                      <input   name= "verifycode "   id= "verifycode "   size= "6 "   maxlength= "4 "
  onFocus= "this.select(); "   onMouseOver= "this.style.background= 'EAEAEA ' "   onMouseOut= "this.style.background= 'FFFFFF ' ">
                    請在左邊輸入 <%=session( "verifycode ")%>
                    <input   type= "hidden "   name= "verifycode2 "   value= " <%=session( "verifycode ")%> ">
                    </label> </td>
                </tr>
                <tr>
                    <td   colspan= "2 "> &nbsp; </td>
                    <td>   <label>
                        <div   align= "center "   class= "style3 ">
                          <input   name= "submit "   type= "submit "   class= "input "   value= "   登   录   ">  
                            <input   type= "reset "   name= "Submit2 "   value= "重質 "   class= "input ">
                        </div>
                    </label> </td>
                </tr>


            </table>
                </form>
        </td>
    </tr>
</table>


conn1.asp

<%
set   conn=server.CreateObject( "Adodb.Connection ")
Path= "driver={sql   server};server=localhost.;uid=sa;pwd=;database=db_people "
conn.open   path  

function   HTMLcode(fString)
if   not   isnull(fString)   then
        fString   =   Replace(fString,   CHR(13),   " ")
        fString   =   Replace(fString,   CHR(10)   &   CHR(10),   " </P> <P> ")
        fString   =   Replace(fString,   CHR(10),   " <BR> ")
fString   =   Replace(fString,   CHR(32),   "&nbsp; ")
        HTMLcode   =   fString
end   if
end   function
response.Write( "cheng   gong   lianjie   ")
%>


check1.asp


<%@LANGUAGE= "VBSCRIPT "   CODEPAGE= "950 "%>
<!-#include   file=gpan/asptest/conn1.asp->

<%
dim     verifycode,verifycode2
verifycode=trim(Request.Form( "verifycode "))
verifycode2=trim(Request.Form( "verifycode2 "))
if       verifycode <> verifycode2   then
response.Write " <SCRIPT   language=JavaScript> alert( 'you   input   the   wrong   code '); "
response.write "location.href= 'index.asp ' </SCRIPT> "
else
session( "verifycode ")= "   "
%>
<%
if   request( "action ")= "login "   then
admin_name=request( "admin_name ")
admin_pass=request( "admin_pass ")
username=trim(request( "admin_name "))
userpwd=trim(request( "admin_pass "))
for   i=1   to     len(username)
user=mid(username,i,1)
if   user= "   "     or   user= "% "   or     user= " < "     or   user= "> "     or   user= "| "     or   user= "& "     then
response.Write   "   <script   language=javescript> "&   "alert( '   you   input   then   wrone   charde,please   input   angin! '); "   &   "history.back() "   &   " </script>   "
response.End()
end   if

next

for   i=1     to   len   (userpwd)
pass=mid(userpwd,i,1)
if   pass= " "   or   pass= "% "     or   user= " < "   or   user= "> "     or   user= "| "   or   user= "& "   then
response.Write   " <script     language=javescript> "   &   "   alert( '   you   input   wrone     charde,plese   input   again ')   "   &   "history.back() "   &   " </script> "
response.End()
end   if
next
%> <br/>


<%
set   rs=server.createobject( "adodb.recordset ")
sql= "select   *   from   users   where   username= ' "&admin_name& " '   and   userpwd= ' "&admin_pass& " ' "
rs.open   sql,conn,1,3         '這里是出錯的第40行  
if   rs.eof   then
response.Write   " <center> 對不起你輸入的密碼或帳號有錯,請重新輸入,謝謝! "


else
session( "admin_name ")=request( "admin_name ")
response.Redirect( "admin.asp ")
end   if
rs.close
set   rs=nothing
conn.close
set   conn=nothing
end   if
end   if
response.Write( "yun   xing   cheng   gong   ")
%>



[解决办法]
sql= "select * from users where username= ' "&admin_name& " ' and userpwd= ' "&admin_pass& " ' "

表名加上[],即
sql= "select * from [users] where username= ' "&admin_name& " ' and userpwd= ' "&admin_pass& " ' "试试
[解决办法]
我测试了一下,就发现数据库连接出了问题,没有发现其他问题

conn1.asp

<%
set conn=server.CreateObject( "Adodb.Connection ")
Path= "driver={SQL Server};server=(local);uid=sa;pwd=;database=db_people "
conn.open path

function HTMLcode(fString)
if not isnull(fString) then
fString = Replace(fString, CHR(13), " ")
fString = Replace(fString, CHR(10) & CHR(10), " </P> <P> ")
fString = Replace(fString, CHR(10), " <BR> ")
fString = Replace(fString, CHR(32), "&nbsp; ")
HTMLcode = fString
end if
end function
response.Write( "cheng gong lianjie ")
%>

[解决办法]
sql= "select * from [users] where username= "&admin_name& " and userpwd= "&admin_pass& " "试试

[解决办法]
Path= "driver={sql server};server=localhost.;uid=sa;pwd=;database=db_people "

localhost后面多了一个点
[解决办法]
和楼上的观点一样.
[解决办法]
数据库没连接上.....建议使用ip地址....
conn1.asp

<%
set conn=server.CreateObject( "Adodb.Connection ")
Path= "driver={SQL Server};server=127.0.0.1;uid=sa;pwd=;database=db_people "
conn.open path


[解决办法]
如果数据库连接字符串没错,那请检查:

你的字段长度是多少.是否值在代入sql语句时,已超出了字段所能接受的最大长度.
[解决办法]
太长了,看的清

热点排行