473,508 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Want to Display the database values in 3 columns.

24 New Member
Hii..
Im retreving the data from database using table1.so im taking the values in array.
so using loop im displaying the values in single line .like
one
two
three
four
five
...
...
...

But i want to display the values like..
one two three
four five six
.. .. ..

my code is here..
Expand|Select|Wrap|Line Numbers
  1.  <table>        
  2. <tr> 
  3. <td >Numbers</td>                
  4. </tr><%
  5. For cnt=1 To UBound(arrayobjrs, 2)+1 Step 1
  6. %>
  7. <tr>
  8. <td ><a href="home.asp?page=numb&id=<%=arrayobjrs(0, cnt-1)%>">&nbsp;<%=arrayobjrs(1, cnt-1)%></a></td>
  9. </tr>
  10. <%
  11. Next %>
  12. </table>
Thanks
Nov 17 '09 #1
2 1899
jeffstl
432 Recognized Expert Contributor
This seems a little overly complicated to me now that I wrote it out, but its been several years since I messed with classic ASP

But in what your describing you might be able to use something like this inside your for loop

Expand|Select|Wrap|Line Numbers
  1.     Select Case cnt
  2.        Case 1
  3.         Response.write "<tr><td>"
  4.        Case 2,3
  5.          'Keep the same row but start a new column
  6.         Response.Write "<td>"
  7.        Case 4
  8.         'start a new row
  9.         Response.write "<tr><td>"
  10.        Case 5,6
  11.          'Keep the same row but start a new column
  12.         Response.Write "<td>"    
  13.     End Select
Nov 17 '09 #2
jhardman
3,406 Recognized Expert Specialist
Jeff's reply will work, but will get longer and longer the more objects in your array. Try this instead:
Expand|Select|Wrap|Line Numbers
  1.  <table>        
  2. <tr> 
  3. <td >Numbers</td>                
  4. </tr><tr><%
  5. dim x
  6. x=0
  7. For cnt=1 To UBound(arrayobjrs, 2)+1 Step 1 %>
  8.    <td ><a href="home.asp?page=numb&id=<%=arrayobjrs(0, cnt-1)%>">&nbsp;<%=arrayobjrs(1, cnt-1)%></a></td>
  9.    <% 
  10.    if x = 2 then %>
  11.       </tr><tr>
  12.    <%
  13.    end if
  14.  
  15.    x = x + 1
  16.    if x = 3 then x = 0
  17. Next %>
  18. </tr></table>
Jared
Nov 19 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4549
by: Scott Vercuski | last post by:
Hello All, I'm having a problem saving/displaying multiple lanaguages on an ASP page. Here's the general problem I'm having. I have an admin area of a website that allows a user to enter items...
2
9895
by: Gnurp Gnarp | last post by:
When the number of columns get large, it becomes increasingly difficult to view the results of a select in a small window (e.g. 80 line xterm) because of line wrapping. Can I have the results of...
2
28526
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
2
10583
by: Brian | last post by:
Hope you all had a great holiday. I have a subform with a table with a combo box based on a select query. The combo box is set to display in a form in datasheet view. When I click the down...
18
3321
by: Alpha | last post by:
Hi, I'm working on a Windows applicaton with VS 2003 on windows 2000. I have a listbox that I have binded to a dataset table, "source" which has 3 columns. I would like to display 2 of those...
2
1785
by: AdamM | last post by:
Currently, my code reads from a database without knowing the order of the columns like this: string name = (string)datarow; However, is there a way to write or do an INSERT back to a database...
0
5797
by: M. David Johnson | last post by:
I cannot get my OleDbDataAdapter to update my database table from my local dataset table. The Knowledge Base doesn't seem to help - see item 10 below. I have a Microsoft Access 2000 database...
10
4260
by: shsandeep | last post by:
The ETL application loaded around 3000 rows in 14 seconds in a Development database while it took 2 hours to load in a UAT database. UAT db is partitioned. Dev db is not partitioned. the...
9
8642
by: Chester | last post by:
I'm working on an app that records data collected by service technicians (VB.Net front-end, SQL Server 2000 back end). The technicians need to record numbers with varying scale and precision. For...
0
7224
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
7120
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
7494
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...
0
5626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5050
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4706
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
763
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.