Re: 2 column display - HELP SQL/ASP
From: SusieQ (rh_at_bloofrog.net)
Date: 11/17/04
- Previous message: Bob Barrows [MVP]: "Re: Timeouts (80040E31) on AddNew"
- In reply to: Jeff Cochran: "Re: 2 column display - HELP SQL/ASP"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 17 Nov 2004 10:04:32 -0800
Thanks Jeff - this certainly helped me understand what the code is I have.
The question I have now is - I understand the loop part on the TD's, but it
looks like that may only be if I want to output all the fields. I only have
4 fields that I actually want to display, but have selected more than that
because of some testing I have to do.
Can you give me any suggestions on how I might handle it that way?
I loop through the records until there are no more
I check for heading content making sure each time the city changes it rights
a row with the new city
I print out in 2 columns, information on 1 company
I print out in the second column all the specials this company may have
I check the heading field and if it is different start this process over
I can't figure out how to make this loop with an array for the life of me.
If I was using the rs object I'd do this
do while not objRs.EOF
write first 2 columns with data
objRs.MoveNext
if objRs.EOF then exit do
write next 2 columns if more data there
objRs.MoveNext
loop
Can you help with this?
"Jeff Cochran" <jeff.nospam@zina.com> wrote in message
news:419b473b.1615910897@msnews.microsoft.com...
> On Tue, 16 Nov 2004 18:53:22 -0800, "SusieQ" <rh@bloofrog.net> wrote:
>
>>I posted this over in the SQL forum, but I think it was the wrong place.
>>My
>>apologies.
>
> It's not really ASP either, it's a matter of client-side formatting,
> in your case HTML tables.
>
> You might look at a cleaner sample of the GetRows method to see what
> you're facing:
>
> http://www.asp101.com/samples/viewasp.asp?file=db%5Fgetrows%2Easp
>
> Then it's a simple matter of setting your loop to not end the row in
> the table until it's pulled the second row into the next column(s).
>
> Jeff
>
>>SQL2K - I have a list that can be printed out in one column of company
>>names
>>and addresses, but they would like to have this in 2 column format. They
>>don't want me to rewrite anything, just add a column.
>>
>>IE: company 1 company2
>> Addr Addr
>>etc
>>
>>I'm stumped. I am having trouble with the former programmers code. It's
>>not documented at all. Here is the page. Normally I would have a
>>recordset
>>and do a recordset.movenext & loop, but this isn't done that way.
>>Here is the location of the page:
>>http://www.happyfacerewards.com/printmerchantcond.asp
>>Scrolling down you will see where I have added the comment for the first
>>column and then the second
>>Can anyone help me with this? I'd be grateful for anything I could get.
>>Thanks so much in advance
>>---------------------------------------------------------------------------------------------------------
>>
>>
>><!--#INCLUDE FILE="functions/functions.asp" -->
>><%
>>'on error resume next
>>
>>Dim strSql
>>Dim allStores, numOfStore
>>Dim lastHeader
>>Dim typeArray,styleArray,categoryList
>>Dim today
>>today=date()
>>
>>strSql="SELECT tblStores.storeId, tblStores.storeName,
>>tblStores.storeAddresse, tblStores.storeCity, tblProvinces.sName,
>>tblCountries.cName, tblStores.storePCode, tblCategory.categoryName,
>>tblStyle.styleName, tblType.typeName, tblOffers.offerId,
>>tblOffers.offerName, tblStores.storePhone, tblStores.storeFax,
>>tblStores.storeEmail, tblStores.storeWebsite, tblMerchant.merchantCode " _
>>& "FROM tblMerchant INNER JOIN (tblCategory INNER JOIN ((tblCountries
>>INNER
>>JOIN tblProvinces ON tblCountries.cId = tblProvinces.sCountryId) INNER
>>JOIN
>>((tblType INNER JOIN (tblStyle INNER JOIN tblStores ON tblStyle.styleId =
>>tblStores.storeStyleId) ON tblType.typeId = tblStores.storeTypeId) INNER
>>JOIN tblOffers ON tblStores.storeId = tblOffers.offerStoreId) ON
>>tblProvinces.sId = tblStores.storeProvinceId) ON (tblCategory.categoryId =
>>tblStores.storeCategoryId) AND (tblCategory.categoryId =
>>tblStyle.styleCategoryId) AND (tblCategory.categoryId =
>>tblType.typeCategoryId)) ON tblMerchant.merchantId =
>>tblStores.storeMerchantId " _
>>& "WHERE tblMerchant.merchantStatusId=2 ORDER BY
>>tblStores.storeCity,tblStores.storeName ASC"
>>
>>Call openDB()
>> Set rs=conn.execute(strSql)
>> If rs.eof Then
>> allStores=Array("Null")
>> numOfStore=-1
>> Else
>> allStores=rs.getRows()
>> numOfStore=Ubound(allStores,2)
>> End If
>>
>> categoryList=allCategory
>> typeArray=arrayOfTypes
>> styleArray=arrayOfStyles
>>Call closeDB()
>>%>
>><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>><HTML><HEAD>
>><TITLE>Happy Face Rewards</TITLE>
>><META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
>><LINK href="global/stylea.css" type=text/css rel=STYLESHEET>
>>
>><script language="JavaScript" type="text/JavaScript">
>><!--
>>function MM_reloadPage(init) { //reloads the window if Nav4 resized
>> if (init==true) with (navigator) {if
>>((appName=="Netscape")&&(parseInt(appVersion)==4)) {
>> document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
>>onresize=MM_reloadPage; }}
>> else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
>>location.reload();
>>}
>>MM_reloadPage(true);
>>//-->
>></script>
>></HEAD>
>><BODY>
>>
>><p><img src="image/main/banner.gif" width="364" height="76"></p>
>><table width=100% border=0 bgcolor="#FFFFFF" align=left cellpadding=3
>>cellspacing=0 valign=top>
>><tr><td colspan="4">
>><table width=100%><tr><td><font class="formtext">Merchants as of:
>><!--#include virtual="/includes/date.htm"--></font></td>
>><td align="right"><font
>>class="formText">http://www.happyfacerewards.com></td></tr>
>><tr><td colspan="2"><hr height=1></td></tr>
>></table></td></tr>
>>
>>---------------- HERE IS THE HEADING WHICH GIVES THE
>>CITY ---------------------
>>
>> <%
>> If numOfStore >-1 Then
>> For x=0 To numOfStore
>> If lastHeader <> allStores(3,x) Then
>> Response.Write "<tr><td colspan=4 align=left><font
>>class=SectionTitlePrint>" & allStores(3,x) & "</font></td></tr>"
>> lastHeader=allStores(3,x)
>> End If
>>
>>---------------- HERE IS THE FIRST COLUMN WHICH
>>WORKS ---------------------
>> Response.Write "<tr>"
>> Response.Write "<td align=left width=250 valign=top><b><font
>>class=offertext>" & allStores(1,x) &"</font></b><br>"
>> Response.Write "<font class=offerText>"& allStores(2,x)& " "&
>>allStores(12,x) & " "& allStores(13,x) &"</font></td>"
>> Response.Write "<td width=250 valign=top><font class=offerText>" &
>>allStores(11,x) & "</font><br>"
>> For y = x+1 To numOfStore
>> If allStores(0,x) = allStores(0,y) Then
>> Response.Write "<font class=offerText>" & allStores(11,y) &
>>"</font><br>"
>> x=y
>> Else
>> Exit For
>> End If
>> Next
>>---------------- THIS IS THE SECOND COLUMN I ADDED, BUT IT JUST DUPLICATES
>>THE FIRST ---------------------
>>
>> Response.Write "</td>"
>> Response.Write "<td align=left width=250 valign=top><b><font
>>class=offertext>" & allStores(1,x) &"</font></b><br>"
>> Response.Write "<font class=offerText>"& allStores(2,x)& " "&
>>allStores(12,x) & " "& allStores(13,x) &"</font></td>"
>> Response.Write "<td width=250 valign=top><font class=offerText>" &
>>allStores(11,x) & "</font><br>"
>> For y = x+1 To numOfStore
>> If allStores(0,x) = allStores(0,y) Then
>> Response.Write "<font class=offerText>" & allStores(11,y) &
>>"</font><br>"
>> x=y
>> Else
>> Exit For
>> End If
>> Next
>>
>>---------------- IF THERE ARE NO MORE STORES, THEN IT
>>ENDS ---------------------
>>
>> If (x <> numOfStore) Then
>> If allStores(3,x) <> allStores(3,x+1) Then
>> Response.Write "</td></tr>"
>> Else
>> Response.Write "</td></tr>"
>> End If
>>
>> Else
>> Response.Write "</td></tr><tr><td colspan=4><hr
>> height=1></td></tr>"%>
>> <tr><td bgcolor="#9966CC" colspan="4" height=10></td></tr>
>> <tr><td><img src="images/logo1.gif"></td><td>
>> <p class="centersmall">Happy Face Rewards<br>A Division of
>>International Fun Card Inc<br>
>> Box 261 106 - 1656 Martin Drive <br>White Rock, B.C. V4A 6E7
>> Canada</p>
>> </td>
>> <td><div align="right"><img
>> src="images/key-face4.gif"></div></td></tr>
>> <%
>> End If
>> Next
>> Else
>> Response.Write "<tr><td bgcolor=#FFD705> </td></tr><tr><td
>>height=290 align=center><font class=formHeader>Your search criteria
>>resulted
>>in 0 matches, please adjust and try again</font></td></tr></table>"
>> End If
>>%>
>></td></tr></table>
>>
>><p>
>>
>></BODY>
>></HTML>
>>
>>
>
- Previous message: Bob Barrows [MVP]: "Re: Timeouts (80040E31) on AddNew"
- In reply to: Jeff Cochran: "Re: 2 column display - HELP SQL/ASP"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|