Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms 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 October 7th, 2004, 01:57 PM
Authorized User
 
Join Date: Jun 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default RE: Not displaying all records

Hello,
I created a report in asp which is suppose to list payments that are pending checks. However, it is only displaying one record. The weird part is when I add the line rs.movenext it displays the next record only. Am I missing something? Any help I would appreciate. :D

slypunk
__________________
slypunk
 
Old October 7th, 2004, 03:04 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Could you post any code? Check your query, that the params being passed in are valid and not causing it to return one row. rs.MoveNext must be there for a loop...

Brian
 
Old October 7th, 2004, 09:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

slypunk,

I think, you don't use any loop mechanism to move through all records and display them. Posting some code would be helpful though.

Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old October 8th, 2004, 06:52 AM
Authorized User
 
Join Date: Jun 2003
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah sorry about that here is the code that loops the recordset:

<%
'loop through each contract
Set rs = GetEstPaymentReport()

dim iRow
iRow = 1

%>
    <tr>
        <td align="center">

                <%=rs.Fields("contno")%>

        </td>
        <td align="center">

                <%=rs.Fields("estno")%>

        </td>
        <td align="center">

                <%=rs.Fields("contractor")%>

        </td>
        <td align="center">

                $<%=rs.Fields("netestamt")%>

        </td>
        <td align="center">

                <%=rs.Fields("submittoap")%>

        </td>
        <td align="center">

                <%=rs.Fields("checkno")%>

        </td>
        <td align="center">

                <%=rs.Fields("checkdate")%>

        </td>
    </tr>
    <%
        ' Update temp field to current project
        currContract = rs.Fields("contno")
    end if
    %>

    <%
    'check if we have read past end of file
    'if not eof, get current contract no
    if not rs.EOF then
        nextContract=rs.Fields("contno")
    else
        nextContract=""
    end if
    %>

I'm not exactly sure if I'm missing something this is the function used to execute the table:


' --- FUNCTIONS STARTS BELOW

Function GetEstPaymentReport()
    ' Add Project
    set rs = server.CreateObject("adodb.recordset")
       SQL = "select * from tblEstimatePayments e(nolock)WHERE e.eststatus='a/p' "
    SQL = SQL & "order by submittoap"

    'if not rs.EOF then
    'run query
      with rs
          .Open sql, cn, 0, 3
          .Update
      end with
    'end if

    '--same concept but more code required
    ' Run Query
    'rs.open sql, cn
    ' Update temp field to current contract
    'rs.Update

    ' Return Records
    set GetEstPaymentReport = rs
    set rs = nothing
End Function

' --- PROCESSING LOGIC STARTS BELOW

dim currContract, nextContract

%>

slypunk
 
Old October 8th, 2004, 10:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi slypunk,

I don't see any need for .Update there within that function after recordset open is performed. You may remove that.

Also I could just see a comment saying 'loop through each contract, but there is no code used to loop through the recordset, which caused this problem for you.

This entire code should be run within a While .... Wend loop as shown below.
Code:
While NOT rs.EOF
%>
    <tr>
        <td align="center">

                <%=rs.Fields("contno")%>

        </td>
        <td align="center">

                <%=rs.Fields("estno")%>

        </td>
        <td align="center">

                <%=rs.Fields("contractor")%>

        </td>
        <td align="center">

                $<%=rs.Fields("netestamt")%>

        </td>
        <td align="center">

                <%=rs.Fields("submittoap")%>

        </td>
        <td align="center">

                <%=rs.Fields("checkno")%>

        </td>
        <td align="center">

                <%=rs.Fields("checkdate")%>

        </td>
    </tr>
    <%rs.MoveNext
WEnd
'''''NOT SURE WHAT THE REMAINING CODE DOES...
 ' Update temp field to current project
        currContract = rs.Fields("contno")
    end if
    %>

    <%
    'check if we have read past end of file 
    'if not eof, get current contract no
    if not rs.EOF then
        nextContract=rs.Fields("contno")
    else
        nextContract=""
    end if
    %>
    Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying Multiple Records on Report bnc111 Access 1 August 16th, 2007 02:10 PM
Displaying records as hyperlinks chbravo Classic ASP Databases 1 December 6th, 2005 07:38 AM
Displaying Records From SELECT dropdown mgordon Classic ASP Databases 12 August 3rd, 2005 12:27 PM
Problem displaying one of the records. mAdg3rr Classic ASP Databases 5 June 24th, 2003 08:56 PM





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