Getrows

1. Senior Member
Join Date
Dec 1969
Posts
258

## Getrows

I have a select stmt like this.. "select a from b"<BR>The result is 3 rows of a.<BR><BR>arr = rs.getrows()<BR>rows = Ubound(arr,2)+1<BR>for I = 1 to rows<BR> ls = Trim(arr(0, i - 1)) & " "<BR>next<BR><BR>But here I am getting the same row... <BR>Please tell me where I am going wrong..<BR><BR>Thanks<BR>Josh

2. Senior Member
Join Date
Dec 1969
Posts
376

## RE: Getrows

Are you sure that it is indeed returning three rows? Do a response.write ubound(arr, 2)<BR><BR>Also, why all the +1 -1 junk? Why not...?<BR><BR>arr = rs.getRows<BR>rows = ubound(arr, 2)<BR>for i = 0 to rows<BR> ls = trim(arr(0, i)) & " "<BR>next

3. Senior Member
Join Date
Dec 1969
Posts
96,118

## RE: Getrows

There is nothing wrong with the code. BUT ... it may not be doing what YOU want.<BR><BR>Look *inside* the loop. What are you doing? Each time through, you assign a BRAND NEW VALUE to the variable "ls".<BR><BR>I *think* that what you are trying to get is all three values strung together, yes?<BR><BR>If you had simply done:<BR><BR>&#060;%<BR>arr = rs.getrows()<BR>rows = Ubound(arr,2)<BR>for i = 0 to rows<BR>&nbsp; &nbsp; Response.Write Trim(arr(0,i) & "&lt;BR&#062;"<BR>next<BR>%&#062;<BR><BR>You would have seen all 3 values. (And, incidentally, notice how I simplified your loop code...you went to a lot of trouble just to start at 1 instead of 0!)<BR><BR>So, *maybe* what you meant to do was this:<BR><BR>&#060;%<BR>arr = rs.getrows()<BR>rows = Ubound(arr,2)<BR>ls = ""<BR>for i = 0 to rows<BR>&nbsp; &nbsp; ls = ls & Trim(arr(0,i) & " "<BR>next<BR>%&#062;<BR><BR>Do you see that? *NOW* you are *appending* each new value to the prior one, instead of resetting "ls" every time through the loop.<BR><BR>If you&#039;re looking to do some manual re-reading, this is nothing to do with GETROWS, if I diagnosed your problem correctly. It has to do with string fundamentals. <BR><BR>

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•