Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2004, 06:51 PM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displacement downwards of dabase records displayed

I am loading in records from an ACCESS 2002 database using a filter to find those matching the search criteria. For each record found I write a row in a table on the screen. The problem is that for every row written to the table, all rows are displaced from the top. That is, instead of all displayed records (rows) starting at the top the following occurs:
If one record is displayed it starts one unit from the top (I measured a distance of 8mm).
If two records are displayed, they start 16 mm from the top, and so on. If I display 35 records they are completely off the screen and I must scroll down to see where they begin. The VALIGN=top instruction has no effect. Would be grateful if anyone has any ideas.

The relevant code:
<%@ LANGUAGE="VBScript" %>
<% Option Explicit
Response.Expires = 0%>
<P><! display.asp 12/13/03></P>
<HTML>

<BODY LINK="#0000ff" VLINK="#800080" BGCOLOR="#BED6D6">
<!



<%
    Dim intTotalLen
. etc.
.

'
' **** Open data base and recordset for Orders table. this is a OLEDB connection
'
Set objConn = Server.CreateObject("ADODB.Connection")
strConn="PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=D:\wwwroot\petrapubcom\database\dbGO2002.md b"
objConn.open strConn
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.CursorLocation = adUseClient

objRS.Open "tblPrivOrders", strConn, adOpenKeyset, adLockReadOnly, adCmdTable
'
' **** set up filter to fetch only pertinent records
'
strCriteria = "Location = '" & strLocation & "' AND Category = '"
strCriteria = strCriteria & strCategory & "' AND SubCategory = '" & strSubCategory & "'"
objRS.Filter = strCriteria
'
' First tell user that search is on
'
Response.Write "For Location: " &strLocation
Response.Write " Searching Category: " &strCategory
Response.Write " For: " &strSubCategory
Response.Write " <BR>"
'
' **** Create start of table for displaying ads
'
Response.Write ("<TABLE BORDER='1' VALIGN='top' width='100%'>")
'
' **** Move through entire Orders Table, selecting only those records that match
'
If Not objRS.EOF Then
    objRS.MoveFirst
'
' **** Top-Level DO LOOP, which displays all relevant ads
'
     Do WHILE Not objRS.EOF
      Response.Write "<TR VALIGN='top'><TD VALIGN='top'>"
      strPicPath="pictures/" & objRS("ThumbPic").value
      IF objRS("ThumbPic").value = "none" THEN
        Response.Write "<IMG SRC='pictures/nophoto.gif' "
        Response.Write "HEIGHT=50 WIDTH=100 ALT='no picture'>"
      Else
        Response.Write "<IMG SRC='"
        Response.Write strPicPath
        Response.Write "' ALT='no picture'>"
      End IF
          Response.Write "</TD><TD VALIGN='top'>"
      .
.etc.


        Response.Write "</TD><BR></TR>"
          objRS.MoveNext

'
' **** End of Top-Level DO LOOP
'
    Loop
Else
    Response.Write "<td align=CENTER> no matches, please try later</td> "

End If
Response.Write ("</TABLE>")

objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>

</BODY>
</HTML>


 
Old January 14th, 2004, 06:06 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

I can't see anything obviously wrong with the layout. I think the easiest way to sort this problem out is by looking at the HTML source which the ASP page generates. It should then be obvious why the records are creeping down the page and you can amend your ASP to eliminate the creeping problem.

If its not obvious, post the HTML here and we'll see what we can see.

hth
Phil
 
Old January 14th, 2004, 10:38 AM
Authorized User
 
Join Date: Dec 2003
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try removing the line break <br> from the end of your top level do loop.

You currently have </td><br></tr>

 
Old January 14th, 2004, 12:28 PM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The problem was the "<br>". Thanks again to jrwlkn.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Non-displacement of controls when visible="false" rsearing ASP.NET 2.0 Professional 2 January 26th, 2007 06:27 PM
Using DSN To Connect Access Dabase [email protected] ASP.NET 1.0 and 1.1 Basics 0 March 22nd, 2006 07:26 AM
Maximum Records Displayed tdaustin Classic ASP Basics 3 June 5th, 2005 07:32 PM
Problem with adding user to dabase ali786 Classic ASP Databases 0 March 9th, 2005 06:34 AM
Refreshing the records displayed in a form DrewMills Access VBA 2 March 3rd, 2005 07:51 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.