dbConnect.Open "dsnname"后面跟帐号、密码

解决方案 »

  1.   

    求:相关ASP和数据库连接的源码,给高分!
    [email protected]
      

  2.   

    你贴错了地方,这里是讨论ASP.NET的地方,不是ASP,还是给你段ASP代码吧
    <%
    dbpath=server.mappath("db\qingxinu.mdb")
    qingxin="DRIVER={Microsoft Access Driver (*.mdb)};PWD=;DBQ="&dbpath
    %>
    <%
    set conn=server.CreateObject("adodb.connection")
    conn.Open qingxinul25%><%
    news="select top 7 ID,title,summary,content,timeissue,countlx,redirect from class0 order by timeissue desc,ID desc"
    set restnews=conn.Execute (news)
    %>
    <table>
      <% do while not restnews.eof %>  
    <tr><td>                                   
    <div> 
    <img border="0" src="images/dot.gif" width="9" height="11">                                   
    <a href="content.asp?class=class0&id=<% =restnews("id") %>" target="_blank">
    <% =restnews("timeissue") %><% ="("&restnews("countlx")&")" %>                                                                
    </div>                                                                     
    <div><% =restnews("summary") %></div>                                                                  
    </td></tr>                                                                 
            <% restnews.movenext                                                                
            loop %>                                                                
    <% restnews.close   
       set restnews=nothing   
     %>    
    </table>
      

  3.   

    修改一下:
    <%
    dbpath=server.mappath("db\qingxinu.mdb")
    qingxin="DRIVER={Microsoft Access Driver (*.mdb)};PWD=;DBQ="&dbpath
    %>
    <%
    set conn=server.CreateObject("adodb.connection")
    conn.Open qingxin%>