locked
SQL ADO Connection RRS feed

  • Question

  • I have an ASP page I'm testing and this is what I'm trying to do with it. I simply need it to read a SQL table on my server and display data from that table on screen. Thats it. But no matter how many times I tweak my code I keep getting 404 web page not found. Here is the entire pages code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"
    <script language="JavaScript">
    <!--
    var win = null;
    function NewWindow(mypage,myname,w,h,scroll){
        LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
        TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
        settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=no'
        win = window.open(mypage,myname,settings)
    }
    //-->
    </script>
        </head>

    <%
    '**************************************************************************
    ' This page will be used as a test page for Guests and Links
    ' its purpose is to simply read the guests and links tables then show
    ' what ever data is in them on the asp page.
    '**************************************************************************

    ' This is the SQL section
    <%
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    con.Open "PROVIDER=SQLOLEDB;DATA Source=IP Address of server here;Initial Catalog=folder name here;User ID=sa;Password=password here"

    set rs = Server.CreateObject("ADODB.recordset")
    sql="SELECT * FROM T_ProgramGuests WHERE GuestID > 1"
    rs.Open sql, conn
    %>

    <table border="1" width="100%">
      <tr>
      <%for each x in rs.Fields
        response.write("<th>" & x.name & "</th>")
      next%>
      </tr>
      <%do until rs.EOF%>
        <tr>
        <%for each x in rs.Fields%>
          <td><%Response.Write(x.value)%></td>
        <%next
        rs.MoveNext%>
        </tr>
      <%loop
      rs.close
      conn.close%>
    </table>

    <p>Company Program Archive<left><HR align="left" WIDTH="50%" SIZE="1" NOSHADE>
    </left>
    <strong><u>Article Title</u></strong><br />
    3/7/2007
    <br /><br />
    <strong>Trust in Cyberspace<br />
    </strong><br />

    Your reputation follows you, even into cyberspace. Online reviews, peer comments
    and user opinions are changing the way we decide to trust other people. Technology
    reporter John Doe sees current website ratings leading the way to a new
    standard of social acceptance.</p>
    </body>
    </html>

    I'm doing something wrong here but I'm not
    Tuesday, March 13, 2007 7:58 PM

Answers


  • 404 just tell that the site could not be found, there is no error in your side, you are either pointing to the wrong IIS or you have configured another port for the WebServer. If you would have a problem within your site you probably would get a 500 error rather than a 404. if you defined a custom error page and you redirected to another one which does not exists, this can also cause a 404 to happen. See the IISLogs for more information what is going on behind the scenes.

    HTH, Jens K. Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---

    Friday, March 16, 2007 11:28 PM

All replies

  • There is not enough information here. You might want to give us your sql server version, say, sql server 2000, and how you configure IIS.

    There are simply too many ways your asp page could deliever a 404 Not Found page.

    Wednesday, March 14, 2007 1:15 AM

  • 404 just tell that the site could not be found, there is no error in your side, you are either pointing to the wrong IIS or you have configured another port for the WebServer. If you would have a problem within your site you probably would get a 500 error rather than a 404. if you defined a custom error page and you redirected to another one which does not exists, this can also cause a 404 to happen. See the IISLogs for more information what is going on behind the scenes.

    HTH, Jens K. Suessmeyer.

    ---
    http://www.sqlserver2005.de
    ---

    Friday, March 16, 2007 11:28 PM