Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


ASP/Ajax SQL query display assistance please

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,53345
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> ASP/Ajax SQL query display assistance please
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 ASP/Ajax SQL query display assistance please - 11/7/2007 7:52:40 AM   
  crlaurence

 

Posts: 1
Score: 0
Joined: 11/7/2007
Status: offline
2 questions please


1) I am using the query below, and able to loop through to display each line (of which there are 910), but what else I need to to display is one additional line at the top of the report that shows the total results total count.  (for this it would be 910)

2) For the column of info  (catpg) the results being shown are now numbers <5

What I need is for    1 =  this      2 =   that     3 = other    4 = final


Thank you to anyone that can assist.

------------------
sql="select prod, descr, ph_publish as publish, isnull(catpg, '') as catpg, isnull(acatpg, '') as acatpg, isnull(scatpg, '') as scatpg, agectr as date from co535.dbo.p1base inner join (select ph_product, pt_Productid, ph_publish, ph_lastchanged from productheader left join (select pt_productid from producttext where pt_type=1 and pt_reference=1     ) as a     on pt_productid = ph_id where pt_productid is null and ph_publish < 5 ) as b on prod = ph_product where prod not in (select prod from co535.dbo.p1br where status='D' or status='S') and catpg like '%' or acatpg like '%' or scatpg like '%' order by catpg"

Dim i
i = 0
i = i + 1
do until rs.EOF

       response.write "        <tr>"                                                    & vbCrLf
       response.write "            <td class=help1> " & i & " </td>"  & vbCrLf
       response.write "            <td class=help1>" & rs.Fields("prod")            & "</td>"  & vbCrLf
       response.write "            <td class=help1>" & rs.Fields("descr")           & "</td>"  & vbCrLf
response.write "            <td class=help1>" & rs.Fields("publish")    & "</td>"  & vbCrLf
       response.write "            <td class=help1>" & rs.Fields("catpg")                        & "</td>"  & vbCrLf
       response.write "            <td class=help1>" & rs.Fields("acatpg")                & "</td>"  & vbCrLf
       response.write "            <td class=help1>" & rs.Fields("scatpg")                & "</td>"  & vbCrLf
       response.write "            <td class=help1>" & rs.Fields("date")                & "</td>"  & vbCrLf
       response.write "        </tr>"                                                & vbCrLf

rs.MoveNext
loop


 
 
Post #: 1
 
 RE: ASP/Ajax SQL query display assistance please - 11/7/2007 6:13:18 PM   
  ehvbs

 

Posts: 2025
Score: 48
Joined: 6/22/2005
From: Germany
Status: offline
Hi crlaurence,

to get the count, you may be able to use rs.RecordCount (depends on the cursor type) or
use "SELECT COUNT( ..." or do the counting yourself (increment I in the loop).
If you have the count early, just response.write a TR containing a TD with suitable colspan
and text; if not, consider adding this row at the bottom of the table.

to map catpg from a number 1..4 to a string, create an array

   Dim aCatPGs : aCatPGs = Array( "??", "this", "that", .. )

and response.write aCatPGs( rs.Fields("acatpg") ).

Good luck!

ehvbs

(in reply to crlaurence)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> ASP/Ajax SQL query display assistance please Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts