473,320 Members | 1,939 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

displaying recordset in columns.....

I have a results table that is 5 columns wide. the recordset is
returned with 48 items. I have no problem displaying 5 per row until I
hit the last row where i get a ADODB.Field error '80020009'

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

My question is how do I close of the table row when I reach the EOF?

i.e

1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 * *

I need to display empty cells (in place of the *'s)or end the row when
there is no data to fill it...how is this done?

Thank you.
Jul 19 '05 #1
4 3959
Before you write *any* of the records, you need to test for .EOF again. If
it's .EOF then continue writing out the rest of the table row with just
<td>&nbsp;</td>, otherwise write out the current record. For te next record,
test for .EOF *again*

Cheers
Ken
"Bryan" <br***********@excite.com> wrote in message
news:42**************************@posting.google.c om...
: I have a results table that is 5 columns wide. the recordset is
: returned with 48 items. I have no problem displaying 5 per row until I
: hit the last row where i get a ADODB.Field error '80020009'
:
: Either BOF or EOF is True, or the current record has been deleted.
: Requested operation requires a current record.
:
: My question is how do I close of the table row when I reach the EOF?
:
: i.e
:
: 1 2 3 4 5
: 1 2 3 4 5
: 1 2 3 4 5
: 1 2 3 4 5
: 1 2 3 4 5
: 1 2 3 * *
:
: I need to display empty cells (in place of the *'s)or end the row when
: there is no data to fill it...how is this done?
:
: Thank you.
Jul 19 '05 #2
Bryan wrote:
I have a results table that is 5 columns wide. the recordset is
returned with 48 items. I have no problem displaying 5 per row until I
hit the last row where i get a ADODB.Field error '80020009'

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

My question is how do I close of the table row when I reach the EOF?

i.e

1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 * *

I need to display empty cells (in place of the *'s)or end the row when
there is no data to fill it...how is this done?

Thank you.


Just a variation on Ken's suggestion.

dim rs,arData,,i,iRow,iRows, iRecords
'After opening the recordset, do this:
If not rs.EOF then arData = rs.GetRows
rs.Close: Set rs=nothing
'close and destroy the connection as well

if isarray(arData) then
response.write "<table rules=cols " & _
"style=""border-collapse:collapse;width:200px"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
'determine the number of table rows
iRecords = ubound(arData,2)+1
iRows = Int(iRecords/5)
if iRows < iRecords/5 then
iRows = iRows + 1
end if
for iRow = 0 to iRows -1
Response.Write "<tr>"
for i = iRow * 5 to iRow * 5 + 4
Response.Write "<td>"
if i <= ubound(arData,2) then
Response.Write arData(0,i)
else
Response.Write "&nbsp;"
end if
Response.Write "</td>"
next 'i
Response.Write "</tr>"
next 'iRow
response.write "</table>"
else
response.write "no records were returned"
end if

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3
Thank you Bob,

but I can't seem to figure out where to insert my results info into
your code....

I can implement the code and it gives me a great display like

12345
67

but if I am trying to display images with titles where would I place
the calls for this information?

Thank you for your help
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message news:<uJ**************@TK2MSFTNGP12.phx.gbl>...
Bryan wrote:
I have a results table that is 5 columns wide. the recordset is
returned with 48 items. I have no problem displaying 5 per row until I
hit the last row where i get a ADODB.Field error '80020009'

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

My question is how do I close of the table row when I reach the EOF?

i.e

1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 * *

I need to display empty cells (in place of the *'s)or end the row when
there is no data to fill it...how is this done?

Thank you.


Just a variation on Ken's suggestion.

dim rs,arData,,i,iRow,iRows, iRecords
'After opening the recordset, do this:
If not rs.EOF then arData = rs.GetRows
rs.Close: Set rs=nothing
'close and destroy the connection as well

if isarray(arData) then
response.write "<table rules=cols " & _
"style=""border-collapse:collapse;width:200px"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
'determine the number of table rows
iRecords = ubound(arData,2)+1
iRows = Int(iRecords/5)
if iRows < iRecords/5 then
iRows = iRows + 1
end if
for iRow = 0 to iRows -1
Response.Write "<tr>"
for i = iRow * 5 to iRow * 5 + 4
Response.Write "<td>"
if i <= ubound(arData,2) then
Response.Write arData(0,i)
else
Response.Write "&nbsp;"
end if
Response.Write "</td>"
next 'i
Response.Write "</tr>"
next 'iRow
response.write "</table>"
else
response.write "no records were returned"
end if

HTH,
Bob Barrows

Jul 19 '05 #4
I believe I figured this one out....thanks again.

Bryan
"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message news:<uJ**************@TK2MSFTNGP12.phx.gbl>...
Bryan wrote:
I have a results table that is 5 columns wide. the recordset is
returned with 48 items. I have no problem displaying 5 per row until I
hit the last row where i get a ADODB.Field error '80020009'

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

My question is how do I close of the table row when I reach the EOF?

i.e

1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 4 5
1 2 3 * *

I need to display empty cells (in place of the *'s)or end the row when
there is no data to fill it...how is this done?

Thank you.


Just a variation on Ken's suggestion.

dim rs,arData,,i,iRow,iRows, iRecords
'After opening the recordset, do this:
If not rs.EOF then arData = rs.GetRows
rs.Close: Set rs=nothing
'close and destroy the connection as well

if isarray(arData) then
response.write "<table rules=cols " & _
"style=""border-collapse:collapse;width:200px"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
Response.Write "<COL width=""40"">"
'determine the number of table rows
iRecords = ubound(arData,2)+1
iRows = Int(iRecords/5)
if iRows < iRecords/5 then
iRows = iRows + 1
end if
for iRow = 0 to iRows -1
Response.Write "<tr>"
for i = iRow * 5 to iRow * 5 + 4
Response.Write "<td>"
if i <= ubound(arData,2) then
Response.Write arData(0,i)
else
Response.Write "&nbsp;"
end if
Response.Write "</td>"
next 'i
Response.Write "</tr>"
next 'iRow
response.write "</table>"
else
response.write "no records were returned"
end if

HTH,
Bob Barrows

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Rahul Chatterjee | last post by:
Hello All I have an asp page in which I am performing the following 1. Querying a database view 2. Returning rows in to a recordset. 3. Looping thru the recordset and printing the data 4....
8
by: Hung Huynh | last post by:
Hi, I'm trying to use either one of these methods to position the cursor in a specific position inside a recordset, but neither one seems to work. For example, I have 10 records in my rsData...
2
by: Steve Marciniak | last post by:
I'm trying to display different recordsets (which are 1 field each) as columns right next to one another. For example, Recordset1 is displayed on the left hand side of the screen. Recordset2 is...
6
by: Jennifer Smith | last post by:
I want to be able to display my recordset as follows: a e b f c g d h Instead of : a b c d
0
by: elcc1958 | last post by:
I need to support a VB6 application that will be receiving disconnected ADODB.Recordset from out DotNet solution. Our dotnet solution deals with System.Data.DataTable. I need to populate a...
3
by: Jane | last post by:
Hi, If anyone could help me with this, I greatly appreciate it. I would like to know how I can display data from a db in multiple columns rather than have it displayed in 1 column per recordset....
22
by: Gerry Abbott | last post by:
Hi all, I having some confusing effects with recordsets in a recent project. I created several recordsets, each set with the same number of records, and related with an index value. I create...
0
by: Thaddeus | last post by:
//Author: //Thaddeus Jacobs, MCP //Kinematic Automation, Inc. //mailto:tjacobs@kinematic.com // //Description: //convert ADO .NET dataset to ADO 2.5 2.6 2.7 recordset and v/v //DataSet to...
1
by: blueheelers | last post by:
I have been researching for several hours on the best way to display images in continous forms in Access 2003. For example, I want to display employee name, email, phone, and picture for each...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.