We help IT Professionals succeed at work.

ASP 3 GETROWS

salasadi
salasadi asked
on
698 Views
Last Modified: 2012-06-21
This asp page designed with nested tables, and have images in the center which made is very hard to populate data from database without mess up the table layout!  I have to put my data inside 2 <TD> .  ,TD>1 and <TD>3 is data <TD>3 is image.  

I have to calculate the number of the record and divide them evenly across the <TD>.    For this purpose, I choose Getrows method to divide the number /2.  this is work if the record is even, but not working correctly if the record is odd.  Sometime I miss the last record and have duplicated record of the one before the last.  


set rstGetRows = db.execute(sql)
arrDBData = rstGetRows.GetRows
iRecFirst = LBOUND(arrDBData,2)
iRecLast = UBOUND(arrDBData,2)
iFieldFirst = LBOUND(arrDBData,1)
iFieldlAST = UBOUND(arrDBData,1)

rstGetRows.CLOSE
SET rstGetRows = NOTHING
DB.CLOSE
SET DB = NOTHING


<TD>1
tablefill = (IrEClAST + 1)/2

FOR i = IrECfIRST TO tablefill
      
response.write "<tr align=right><td><a href='getarticle.asp?articleid=" & arrDBData(J ,I) & "'>" & arrDBData(J+1,I)
response.write  " - " & arrDBData(J +4,I) &"</a></td></tr>"


NEXT
<TD>fixed flash object</td>

<TD>3

FOR i = tablefill  TO IrEClAST
      




response.write "<a href='getarticle.asp?articleid=" & arrDBData(J ,I) & "'>" & arrDBData(J+1,I)
response.write  " - " & arrDBData(J +4,I) &"<br>"


'NEXT
NEXT
Comment
Watch Question

Commented:
>>  this is work if the record is even, but not working correctly if the record is odd

Do you mean if the total number of records is even or odd, or if the record being processed on a particular row is even or odd?

Author

Commented:
the number of the records that retrun from database.  
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Forced accept.

Computer101
EE Admin
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.