473,396 Members | 1,884 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,396 software developers and data experts.

Qry data to Page

I have the following data pulled from a db query - it is calculating the
total number of listings for a given category.

CountOfmain_cat_id main_cat_id main_cat
7 1 Clubs
1 2 Accessories
3 3 Apparel
6 4 Instruction
1 5 Course Equipment
2 8 Real Estate
1 9 Employment
1 10 General

I need to display that information on a page, but not it table. I have
an example mocked-up.

http://brettatkin.com/example.gif

Next to each Cat listing, I put the number of ads for that category (5 Ads).

How do I make this happen, take the data from the rs and put it next to
each Category heading?

I need to assign the value of CountOfmain_cat_id to a variable for each
row so that I can reference that variable in the HTML next to each cat
heading.

I'm stuck... Any ideas?

Thanks.

Brett
Nov 20 '06 #1
3 1189

"BaWork" <ba****@sprynet.comwrote in message
news:uP**************@TK2MSFTNGP04.phx.gbl...
I have the following data pulled from a db query - it is calculating the
total number of listings for a given category.

CountOfmain_cat_id main_cat_id main_cat
7 1 Clubs
1 2 Accessories
3 3 Apparel
6 4 Instruction
1 5 Course Equipment
2 8 Real Estate
1 9 Employment
1 10 General

I need to display that information on a page, but not it table. I have
an example mocked-up.

http://brettatkin.com/example.gif

Next to each Cat listing, I put the number of ads for that category (5
Ads).
>
How do I make this happen, take the data from the rs and put it next to
each Category heading?

I need to assign the value of CountOfmain_cat_id to a variable for each
row so that I can reference that variable in the HTML next to each cat
heading.

I'm stuck... Any ideas?

<table>
<tr><td>
<%
Dim i : i = 0
Do Until rs.EOF

'Place code and markup to render contents here

rs.MoveNext

If Not rs.EOF Then
If (i Mod 2) = 0 Then
Response.Write "</td><td>"
Else
Response.Write "</td></tr><td>"
End If
End If
i = i + 1
Loop
%>
</td></tr>
</table>
Thanks.

Brett

Nov 20 '06 #2
Thanks for the help.

This is what I ended up with:

<%
Do Until rs_ad_count.EOF

Select Case rs_ad_count.Fields.Item("main_cat_id").Value

Case "1"
clubs_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "2"
accessories_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "3"
apparel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "4"
instruction_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "5"
equipment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "6"
travel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "7"
services_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "8"
real_estate_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "9"
employment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "10"
general_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
End Select

rs_ad_count.MoveNext
Loop
%>
Anthony Jones wrote:
"BaWork" <ba****@sprynet.comwrote in message
news:uP**************@TK2MSFTNGP04.phx.gbl...
>>I have the following data pulled from a db query - it is calculating the
total number of listings for a given category.

CountOfmain_cat_id main_cat_id main_cat
7 1 Clubs
1 2 Accessories
3 3 Apparel
6 4 Instruction
1 5 Course Equipment
2 8 Real Estate
1 9 Employment
1 10 General

I need to display that information on a page, but not it table. I have
an example mocked-up.

http://brettatkin.com/example.gif

Next to each Cat listing, I put the number of ads for that category (5

Ads).
>>How do I make this happen, take the data from the rs and put it next to
each Category heading?

I need to assign the value of CountOfmain_cat_id to a variable for each
row so that I can reference that variable in the HTML next to each cat
heading.

I'm stuck... Any ideas?

<table>
<tr><td>
<%
Dim i : i = 0
Do Until rs.EOF

'Place code and markup to render contents here

rs.MoveNext

If Not rs.EOF Then
If (i Mod 2) = 0 Then
Response.Write "</td><td>"
Else
Response.Write "</td></tr><td>"
End If
End If
i = i + 1
Loop
%>
</td></tr>
</table>
>>Thanks.

Brett


Nov 20 '06 #3

"BaWork" <ba****@sprynet.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Thanks for the help.

This is what I ended up with:

<%
Do Until rs_ad_count.EOF

Select Case rs_ad_count.Fields.Item("main_cat_id").Value

Case "1"
clubs_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "2"
accessories_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "3"
apparel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "4"
instruction_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "5"
equipment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "6"
travel_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "7"
services_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "8"
real_estate_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "9"
employment_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
Case "10"
general_count = rs_ad_count.Fields.Item("CountOfmain_cat_id").Valu e
End Select

rs_ad_count.MoveNext
Loop
%>
Seems to me that what would be better would be to store the category
description and gif file name in the database and include them in the query
output. The page content is then driven by the DB. If you want to add a
new category you upload a new gif for it and make a change the DB. There
would be no need to modify this page to cope with a new category.

Nov 20 '06 #4

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

Similar topics

10
by: Noozer | last post by:
Below is some ASP, HTML and javascript. It is part of a page used to maintain a small database. This code did work at one time, but has since stopped. For some reason the data on my form is not...
2
by: jimb | last post by:
I need some advice on how to securely transfer data between two servers. Here is the situation. We have two sql servers that hold student data. I have full access to my sql server, but only write...
1
by: krian | last post by:
Hi, I need a help from anybody. My problem is here I wrote two WebApplication in ASP.net Using C#. The name of the applications are (Journal.aspx and Payment.aspx). These Two pages have DataGrids...
2
by: Matt | last post by:
When we submit the form data to another page, we usually do the following: <form action="display.aspx" method="post"> will submit the form data and open display.asp in the current browser ...
2
by: ejs | last post by:
Please read the entire reponse, hopefully this clears up your questions. The data used that needs to go into the batchupload page comes from a server. My problem is that currently I write a file...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
4
by: Vasantha peddireddy | last post by:
I am posting a page to another page (form post). The data grid on the second page is being populated with data. Now, on page load of the second page, I would like to send the grid data on this page...
17
by: stathis gotsis | last post by:
Hello everyone, I am tying to come up with an elegant way to process some input data that come from a form. When the user hits the 'Submit' button, i want the form to appear again with the...
5
by: rAinDeEr | last post by:
Hi, I have a web application with a table to store terms and conditions of a Company. This may some times run into many pages and some times it may be just a few sentences. It is a character...
3
by: planey | last post by:
Hi, I was reading topic about setters and getters (http://www.thescripts.com/forum/thread631267.html) and wanted to ask, how they should be used? I have noticed that a general data validators suck,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...

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.