473,666 Members | 1,991 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to display data in 3 columns by 4 rows format

All,

I will be eternally greatful if someone can provide snippet of code,
URL or reference material that shows how to display data in a "n
colums * n rows" format.

I am new to ASP and have looked everywhere that I could, but I have
not found an example where data can be formatted to be displayed in a
3 * 4 foramt, like many of the professional sites would do (actually
rows and columns can be any number of rows and columns) All the
examples that I have seen, show data displayed in a top down format.

Best Regards,

Addi
Jul 19 '05 #1
3 5309
Take a look at the samples here. http://www.aspfaq.com/show.asp?id=2247

Ray at home

"addi" <ad****@hotmail .com> wrote in message
news:6f******** *************** *@posting.googl e.com...
All,

I will be eternally greatful if someone can provide snippet of code,
URL or reference material that shows how to display data in a "n
colums * n rows" format.

I am new to ASP and have looked everywhere that I could, but I have
not found an example where data can be formatted to be displayed in a
3 * 4 foramt, like many of the professional sites would do (actually
rows and columns can be any number of rows and columns) All the
examples that I have seen, show data displayed in a top down format.

Best Regards,

Addi

Jul 19 '05 #2
ljb
Even though Addi didn't specifically ask I'll mention a slight "enhancemen t"
to the code here.

"Ray at <%=sLocation% >" <myFirstNameATl ane34dotKOMM> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Take a look at the samples here. http://www.aspfaq.com/show.asp?id=2247

Ray at home


I like to see my tables present data ordered such that columns are read from
top down rather than rows across. To do that almost always requires an array
(unless you use XML and XSLT) that can be accessed by index. In the second
example with a recordset that can be accomplished by creating an array with
ADO's getrows method. The key is to predetermine how many columns are
desired and how many rows of data are provided. If you want 5 columns go to
every rows mod 5 array index and so on.

LJB
Jul 19 '05 #3
Well I got the data to display the way I wanted using the example provided
in the following links. Now I am stuck with another dilema. I am trying to
implement paging within my example and it does not seem to page thru. I have
used two independent examples (1 for paging, the other for displaying data)
and they both seem to work fine. When I combine them, it only processes the
first 9 records and paging does not seem to work. Any input on where the
code is broken would be greatly appreciated. The following is a working
example, using the pubs database in SQL Server.
<%
set conn = Server.CreateOb ject("ADODB.Con nection")
conn.Open "DSN=wbsql" , "sa", "golf"

set rs = Server.CreateOb ject("ADODB.Rec ordset")
rs.CursorLocati on = 3 ' adUseClient
rs.Open "Select * from pubs..authors", conn
intPageCount = rs.PageCount
rs.PageSize = 9

Select Case Request("Action ")
case "<<"
intpage = 1
case "<"
intpage = Request("intpag e")-1
if intpage < 1 then intpage = 1
case ">"
intpage = Request("intpag e")+1
if intpage > intPageCount then intpage = IntPageCount
Case ">>"
intpage = intPageCount
case else
intpage = 1
end select
%>
<table border="2" align=center>
<%
numCols = 3
intPage = rs.AbsolutePage
rsPageSize = rs.PageSize
i = 0

Do while i < rsPageSize
needFooter = true

if i mod numCols = 0 then
response.write "<tr>"
end if

response.write "<td align=center>"
response.Write "<P>" & rs(0) & "</P>"
response.Write "<P>" & rs(1) & "</P>"
response.Write "<P>" & rs(2) & "</P>"

response.write "</td>"

if i mod numCols = numCols - 1 then
response.write "</tr>"
needFooter = false
end if
i = i + 1
rs.MoveNext
Loop

if needFooter then
response.write "<td colspan=" &_
numCols - (i mod numCols) &_
"> </td></tr>"
end if
response.write "</table>"

rs.Close
set rs = Nothing
conn.Close
set conn = nothing
%>
</table>
<%

%>
<form name="MovePage" action="test1.a sp" method="post" ID="Form1">
<input type="hidden" name="intpage" value="<%=intpa ge%>" ID="Hidden1">
<input type="submit" name="action" value="<<" ID="Submit1">
<input type="submit" name="action" value="<" ID="Submit2">
<input type="submit" name="action" value=">" ID="Submit3">
<input type="submit" name="action" value=">>" ID="Submit4">
Page: <%=Intpage & " of " & intpagecount%>
</form>
</BODY>
</HTML>
Best Regards,

Addi
"ljb" <.> wrote in message news:eO******** ******@tk2msftn gp13.phx.gbl...
Even though Addi didn't specifically ask I'll mention a slight "enhancemen t" to the code here.

"Ray at <%=sLocation% >" <myFirstNameATl ane34dotKOMM> wrote in message
news:%2******** ********@TK2MSF TNGP11.phx.gbl. ..
Take a look at the samples here. http://www.aspfaq.com/show.asp?id=2247

Ray at home

I like to see my tables present data ordered such that columns are read

from top down rather than rows across. To do that almost always requires an array (unless you use XML and XSLT) that can be accessed by index. In the second
example with a recordset that can be accomplished by creating an array with ADO's getrows method. The key is to predetermine how many columns are
desired and how many rows of data are provided. If you want 5 columns go to every rows mod 5 array index and so on.

LJB

Jul 19 '05 #4

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

Similar topics

2
4431
by: ben moretti | last post by:
hi i'm learning python, and one area i'd use it for is data management in scientific computing. in the case i've tried i want to reformat a data file from a normalised list to a matrix with some sorted columns. to do this at the moment i am using perl, which is very easy to do, and i want to see if python is as easy. so, the data i am using is some epiphyte population abundance data for particular sites, and it looks like this:
32
4143
by: Rich | last post by:
I'm sure it sounds kinda nutty to display 200 columns and 500,000 rows of data. But I have been pulling data from a Lotus Notes database into Sql Server for a while now, but Lotus Notes is starting to crack, columns getting corrupted. Can't handle the volume of data and number of columns. Sql Server has no problem. But displaying the data is the big deal. The end users want to be able to scroll acros a page to the colum of their...
18
3338
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 columns, "scode" and "sname", as 1 column (if not possible then 2 columns will be fine) in the listbox. Can the listbox display 2 columns information from the dataset and how can I do that? Also, I set the property of the listbox to selectionmode...
1
5287
by: Craig Banks | last post by:
If a row of data in a dataset has a lot of columns the row displaying the data in a datagrid will run way off the screen. What I'd like to do is display a row of data over several datagrid rows so the user doesn't have to scroll horizontally. Essentially, I want to wrap a datagrid row (not text in individual columns) with as much control as possible. Make sense? While this seems simple enough on the surface, I can't figure out how to do...
4
2479
by: Joe Van Meer | last post by:
Hi, Is the datalist meant for one table or can I use it to display information from 2 different tables? Or should I be looking at a datagrid instead? I began my code and kinda ran into a snag where my last two columns I am displaying are ID fields, one for clientid and the other for empid. What I would really like is to display their actual names instead of the ids.
6
3830
by: Hutty | last post by:
I've looked around and have yet to find anything that would answer my question regarding formating a column in a datagrid. My grid looks like this as far as data" AMHQCON|51300.01|-3147 The first two columns are pretty much text column, but subsequent columns 1-12 are numerical. I'm trying to get the thousand separator to work. Any ideas?
0
5811
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 which indexes computer magazine articles for personal reference. I am developing a Visual Basic.NET program whose sole purpose is to enter new records into the database. No updates to existing entries, no deletions, and no display
7
1728
by: =?Utf-8?B?aWxy?= | last post by:
Hi I have a table in an sql database that contains data that has been encrypted using the DPAPI. What I am trying to achieve is to bind several controls on a vb 2005 windows form to those fields but display the decrypted data in the controls instead of the encrypted data. I also want to use a binding navigator to scroll through the records and to add/delete records. I don't have a problem with the encryption/decryption but am...
1
2040
by: xiao | last post by:
HI~ guys , I have a program here (Sorry it is very long about 240 lines.) It can read and write the header information successfully but it cannot write the array successfully. I guess there is something wrong with the Write2DArrayInt function there. Can any one henlp me to find it out? Thank you~ (BTW : The printf function in line 114 and 139 implys that the data is right, but after that , in the new generated file, the values are all...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8640
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7386
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5664
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.