473,398 Members | 2,335 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,398 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 3964
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.