Wrapping columns of database results (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


samsquared -> Wrapping columns of database results (2/27/2002 21:35:24)

I want to display only the names from an employee database, but I'd like to have it display as 4 columns instead of 1 long column (or drop-down).

For example, if there are 120 employees, I'd like the first 30 to be in the first column, the next 30 to be in the second column, etc.

Thanks






William Lee -> RE: Wrapping columns of database results (2/28/2002 0:30:12)

A simple alternative is to display the records in group and you can specify how many 30. You can do this in Step 5 of 5 of the DRW. The DRW will provide a set of Navbars for you to page the returned records.



William Lee




samsquared -> RE: Wrapping columns of database results (3/11/2002 13:43:29)

I found a way to do this that does not use database results wizard. It's fairly easy to do using ASP.

Go to this URL:
http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=178

I used the code in the last example. NOTE - there is a bug. The line that reads

rec = startRec + col * COLUMN_COUNT

should be changed to

rec = startRec + col * rowCount

Otherwise, it works fine!







evansforsyth -> RE: Wrapping columns of database results (9/13/2003 22:45:01)

Well, got this far . . .

I'm sure someone with a bit of ASP knowledge will see the problem right away--unfortunately that someone is not me!

Here is the code:

-----------------------------
<%
Const COLUMN_COUNT = 4 ' or 2 or 4 or ...
column = 0 ' initialize counter

Do While Not fp_rs.EOF

' put in <TR> at beginning of group:
If column = 0 Then Response.Write "<TR>"
Response.Write "<TD>" & _
FP_FieldVal(fp_rs,"MN") & "</TD>"
column = column + 1

If column = COLUMN_COUNT Then
Response.Write "</TR>" & vbNewLine
column = 0 ' start over!
End If

fp_rs.MoveNext ' this seems to be where the problem is!

Loop

' clean up last row, if needed!
If column <> 0 Then
For c = column To COLUMN_COUNT
Response.Write "<TD></TD>"
Next
Response.Write "</TR>" & vbNewLine
End If

%>

------------------------

Here is the problem:

After working very well, and showing the data appropriately, this error message shows up:

"Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record. "

Sure appreciate the help!




evansforsyth -> RE: Wrapping columns of database results (9/14/2003 12:37:43)

Added the following line at top of the code:

On Error Resume Next

This got rid of the error message (Seems that the line "Do While Not fp_rs.EOF" requires that it be open on a current record)!

Is this dangerous? Will "On Error Resume Next" turn itself off at the end of that section of code--or at the end of the page?

Thanks

Evans




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
8.007813E-02