DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Aidan Guest

    MS Access can't producing ASP pages.


    I'm using Windows 98 and have installed a Personnel Web Server from the FrontPage
    98 CD. I've been trying to connect a MS Access 97 database to an ASP page
    with no luck so decided to get the Access wizard to do it.

    Access can create a static HTML pages of my table "cars" correctly and will
    show all the records.

    But if I get the wizard to create an ASP page of the same table "cars" the
    ASP page created will have a blank table (i.e. will not show any records).
    I have set the Database Cars.mdb in the System DNS to Parking and have set
    the folder rights were I have put the ASP to executable and Read. I have
    put cars.mdb in the same folder.

    I'm lost now. Is the ASP not opening the database correctly. Has Access set
    the code wrong to get the records or more than likely do I have some settings
    wrong? Does ASP pages work with this version of PWS?

    I've copied the ASP file created by MS Access below.

    Any help would be great just to get me past this brick wall.

    Thanks for your help.

    Aidan keogh
    e-mail: KeoghA@netc.ie

    -------------------------------------------------------------------------
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=windows-1252">
    <TITLE>Cars</TITLE>
    </HEAD>
    <BODY>
    <%
    Param = Request.QueryString("Param")
    Data = Request.QueryString("Data")
    %>
    <%
    If IsObject(Session("parking_conn")) Then
    Set conn = Session("parking_conn")
    Else
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.open "parking","",""
    Set Session("parking_conn") = conn
    End If
    %>
    <%
    sql = "SELECT * FROM [Cars]"
    If cstr(Param) <> "" And cstr(Data) <> "" Then
    sql = sql & " WHERE [" & cstr(Param) & "] = " & cstr(Data)
    End If
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 3, 3
    %>
    <TABLE BORDER=1 BGCOLOR=#ffffff CELLSPACING=0><FONT FACE="Arial" COLOR=#000000><CAPTION><B>Cars</B></CAPTION>

    <THEAD>
    <TR>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>carID</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>carName</FONT></TH>
    <TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>szID</FONT></TH>

    </TR>
    </THEAD>
    <TBODY>
    <%
    On Error Resume Next
    rs.MoveFirst
    do while Not rs.eof
    %>
    <TR VALIGN=TOP>
    <TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("carID").Value)%><BR></FONT></TD>
    <TD BORDERCOLOR=#c0c0c0 ><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("carName").Value)%><BR></FONT></TD>
    <TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("szID").Value)%><BR></FONT></TD>

    </TR>
    <%
    rs.MoveNext
    loop%>
    </TBODY>
    <TFOOT></TFOOT>
    </TABLE>
    </BODY>
    </HTML>
    --------------------------------------------------------------------------------------------------------------


  2. #2
    sergey Guest

    Re: MS Access can't producing ASP pages.


    If there are no run-time errors when displaying the page then my guess that
    it has something to do with WHERE clause. And shouldn't the connection string
    be something like DSN=parking;UID=Admin;Password=;

    sergey

    "Aidan " <keoghA@netc.ie> wrote:
    >
    >I'm using Windows 98 and have installed a Personnel Web Server from the

    FrontPage
    >98 CD. I've been trying to connect a MS Access 97 database to an ASP page
    >with no luck so decided to get the Access wizard to do it.
    >
    >Access can create a static HTML pages of my table "cars" correctly and will
    >show all the records.
    >
    >But if I get the wizard to create an ASP page of the same table "cars" the
    >ASP page created will have a blank table (i.e. will not show any records).
    >I have set the Database Cars.mdb in the System DNS to Parking and have set
    >the folder rights were I have put the ASP to executable and Read. I have
    >put cars.mdb in the same folder.
    >
    >I'm lost now. Is the ASP not opening the database correctly. Has Access

    set
    >the code wrong to get the records or more than likely do I have some settings
    >wrong? Does ASP pages work with this version of PWS?
    >
    >I've copied the ASP file created by MS Access below.
    >
    >Any help would be great just to get me past this brick wall.
    >
    >Thanks for your help.
    >
    >Aidan keogh
    >e-mail: KeoghA@netc.ie
    >
    >-------------------------------------------------------------------------
    ><HTML>
    ><HEAD>
    ><META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=windows-1252">
    ><TITLE>Cars</TITLE>
    ></HEAD>
    ><BODY>
    ><%
    >Param = Request.QueryString("Param")
    >Data = Request.QueryString("Data")
    >%>
    ><%
    >If IsObject(Session("parking_conn")) Then
    > Set conn = Session("parking_conn")
    >Else
    > Set conn = Server.CreateObject("ADODB.Connection")
    > conn.open "parking","",""
    > Set Session("parking_conn") = conn
    >End If
    >%>
    ><%
    > sql = "SELECT * FROM [Cars]"
    > If cstr(Param) <> "" And cstr(Data) <> "" Then
    > sql = sql & " WHERE [" & cstr(Param) & "] = " & cstr(Data)
    > End If
    > Set rs = Server.CreateObject("ADODB.Recordset")
    > rs.Open sql, conn, 3, 3
    >%>
    ><TABLE BORDER=1 BGCOLOR=#ffffff CELLSPACING=0><FONT FACE="Arial" COLOR=#000000><CAPTION><B>Cars</B></CAPTION>
    >
    ><THEAD>
    ><TR>
    ><TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>carID</FONT></TH>
    ><TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>carName</FONT></TH>
    ><TH BGCOLOR=#c0c0c0 BORDERCOLOR=#000000 ><FONT SIZE=2 FACE="Arial" COLOR=#000000>szID</FONT></TH>
    >
    ></TR>
    ></THEAD>
    ><TBODY>
    ><%
    >On Error Resume Next
    >rs.MoveFirst
    >do while Not rs.eof
    > %>
    ><TR VALIGN=TOP>
    ><TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("carID").Value)%><BR></FONT></TD>
    ><TD BORDERCOLOR=#c0c0c0 ><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("carName").Value)%><BR></FONT></TD>
    ><TD BORDERCOLOR=#c0c0c0 ALIGN=RIGHT><FONT SIZE=2 FACE="Arial" COLOR=#000000><%=Server.HTMLEncode(rs.Fields("szID").Value)%><BR></FONT></TD>
    >
    ></TR>
    ><%
    >rs.MoveNext
    >loop%>
    ></TBODY>
    ><TFOOT></TFOOT>
    ></TABLE>
    ></BODY>
    ></HTML>
    >--------------------------------------------------------------------------------------------------------------
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links