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

数据库连接缺少对象。该如何处理

2012-02-22 
数据库连接缺少对象。。。。htmlheadMETAnameVI60_defaultClientScriptcontentVBScriptmetahttp-equi

数据库连接缺少对象。。。。
<html>      
    <head>      
    <META       name=VI60_defaultClientScript       content=VBScript>      
    <meta       http-equiv= "Content-Type "       content= "text/html;       charset=gb2312 ">      
    <title> asp树的研究 </title>      
    </head>      
    <style       type= "text/css ">      
    <!--      
    .aa       {      
    font-size:       14px;      
    color:       #000000;      
    text-align:       center;      
    vertical-align:       middle;      
    letter-spacing:       0px;      
    word-spacing:       0px;      
    }      
    -->      
    </style>      
    <body       bgcolor= "DEE3F7 ">      
    <%      
                            dim       cn,rs,rs1,SQL,Para,NumChild      
                            set       cn=server.CreateObject( "ADODB.connection ")      
                            set       rs=server.createobject( "ADODB.recordset ")      
                            set       rs1=server.createobject( "ADODB.recordset ")      
                            cn.Open     "Provider=Microsoft.Jet.OLEDB.4.0;Data   Source= "   &   Server.MapPath( " "&tree.mdb& " ")                          
                            SQL= "Select       *       from       tree       order       by       ID "      
                            rs.open       SQL,cn,3,2                          
    do       while       not       rs.EOF          
    SQL= "Select       ID       from       tree       where       ID       like       ' "       &       rs( "ID ")       &       "% '       and       ID <> ' "       &       rs( "ID ")       &       " '       order       by       ID "      


    Para=rs( "ID ")       &       "| "      
    NumChild=0      
    rs1.open       SQL,cn,       3,2      
    NumChild=rs1.RecordCount      
    do       while       not       rs1.EOF          
    Para       =Para           &       rs1( "ID ")       &       "| "      
    rs1.MoveNext      
    loop      
    Para=cstr(trim(left(Para,len(Para)-1)))      
    rs1.Close      
    %>      
    <table   id= "T <%=rs( "ID ")%> "          
    border=1          
    cellpadding=0          
    cellspacing=0          
    bordercolor= "#DEE3F7 "          
    class= "aa "          
    abbr= " <%=Para%> "      
    summary= <%=checkid(rs( "ID "))%>      
    style= "cursor:hand "      
    onClick= "vbs:subtree       ' <%=Para%> ' "       >      
       
            <tr>          
    <td       width= " <%=17+checkid(rs( "ID "))*20%> "          
    height= "20 "       align= "right ">          
    <table       width= "20 "       height= "20 "       border= "1 "       cellpadding= "0 "       cellspacing= "0 "       bordercolor= "#DEE3F7 ">      
                                    <tr>      
                       
                                            <td       align= "center "       valign= "middle "       bordercolor= "#000000 "       id= "R <%=rs( "ID ")%> "       > <%if       NumChild=0       then       Response.Write       ". "       else       Response.Write       "- "%> </td>      
            </tr>      
    </table>      
            </td>      


       
                    <td   height= "20 "          
    nowrap      
    bordercolor= "#FFFFFF "          
    onMouseOver= "vbs:me.bgcolor= '#CCCCCC ':me.bordercolor= '#999999 ' "      
    onMouseOut= "vbs:me.bgcolor= '#DEE3F7 ':me.bordercolor= '#ffffff ' "      
    title= " <%=rs( "HyperLink ")%> ">          
                            <%=rs( "Name ")%> </td>      
            </tr>      
        </table>      
       
           
    <%      
        rs.MoveNext      
        loop      
        rs.Close:set       rs=nothing      
        cn.Close:set       cn=nothing      
        function       checkid(x)      
    dim   Tempnum      
    Tempnum=0      
    for       i=1       to       len(x)      
    if       mid(x,i,1)= "_ "       then          
    Tempnum=Tempnum+1      
    end       if      
    next      
    checkid=Tempnum      
        end       function          
       
       
        %>      
            <script       language=VBS>      
    sub       subtree(Client_para)      
    if       instr(Client_para, "| ")=0       then       exit       sub      
    Myarray=split(Client_para, "| ")      
    Mytext=eval( "R "       &       Myarray(0)       &       ".innertext ")      
    select       case       Mytext      
    case       "+ "      
    document.all.item( "R "       &       Myarray(0)).innertext= "- "      
    for       i=1       to       ubound(Myarray)      
    if           eval( "T "       &       Myarray(i)       &       ".summary ")-eval( "T "       &       Myarray(0)       &       ".summary ")=1       then      


    document.all.item( "T "       &       Myarray(i)).style.display= "block "      
    end       if      
    if           eval( "T "       &       Myarray(i)       &       ".summary ")-eval( "T "       &       Myarray(0)       &       ".summary ")> 1       then      
    document.all.item( "T "       &       Myarray(i)).style.display= "none "      
    end       if      
    next      
    case       "- "      
    document.all.item( "R "       &       Myarray(0)).innertext= "+ "      
    for       i=1       to       ubound(Myarray)      
    if           eval( "T "       &       Myarray(i)       &       ".summary ")-eval( "T "       &       Myarray(0)       &       ".summary ")> =1       then      
    document.all.item( "T "       &       Myarray(i)).style.display= "none "      
    if       eval( "R "       &       Myarray(i)       &       ".innertext ")= "- "       then      
    document.all.item( "R "       &       Myarray(i)).innertext= "+ "      
    end       if      
    end       if      
    next      
    end       select      
    set       Myarray=nothing      
    end       sub      
       
    Sub       document_onselectstart      
    document.selection.clear      
    End       Sub      
       
    if       isobject(eval( "T1 "))           then          
    subtree       document.all( "T1 ").abbr      
    subtree       document.all( "T1 ").abbr      
    end       if      
    </script>      
       
    </html>      


25行   连接数据库的地方   提示   缺少对象。。晕   网上找的代码。。看不出问题     帮下忙,,,

------解决方案--------------------


1\cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath( "tree.mdb ")
2\检查数据库tree.mdb路径
[解决办法]
我好晕 ... 帖关键代码就是了嘛 这么多 打死都不看

热点排行
Bad Request.