p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: Problems in Displaying Data


Message #1 by "Mitten Shah" <mittenshah@h...> on Thu, 23 Aug 2001 21:21:33 +0000
Thanks alot John, the code worked but there's one small problem, the output im getting is something like
this:

Authors : Title : Year : Authors : Title : Year : Steeve,  Summers
Title : Management,  &
Year : 2001
Tom,  Spencer 

But how can i make my display look like this:

Author: Steeve Summers, Tom Spencer

Title: Management

Year: 2001

Here is my code:

<%

Dim objRS, objRS1,objComm,objComm1, objParam,objParam1, strJournal,strJournal1,varDropBox

Dim sTmp

Dim sPrevTitle

Dim sPrevYear


varDropBox = Request.Form("style")

Set objComm = Server.CreateObject("ADODB.Command")

objComm.ActiveConnection = strConnect

objComm.CommandText = "searchJournal"

objComm.CommandType = adCmdStoredProc


Set objParam =_

objComm.CreateParameter("Required Journal",adVarChar,adParamInput,50)

objComm.Parameters.Append objParam


strJournal = Request.Form("Journal")

objComm.Parameters("Required Journal") = strJournal


Set objRS = objComm.Execute

 

'Response.Write "<h1>Journal Articles by " & strJournal & "<br>"      

While Not objRS.EOF

Select Case varDropBox

Case "normal"

 

Response.Write "Authors : "

if left(stmp, 10) = "Authors : " then

stmp = "Authors : "

end if

stmp = stmp & objRS("FName") & "," & "  " &_

objRS("LName") &"<br>"

 

Response.Write "Title : "

if sPrevTitle = objRS("Title") then

else

stmp = stmp & vbcrlf & "Title : "

stmp = stmp & objRS("Title") & "," & "  " & "&<br>"

sPrevTitle = objRS("Title")

end if

 

Response.Write "Year : "

if sPrevYear = objRS("Year") then

'you already have this year - dont reprint it

else

stmp = stmp & "Year : "

stmp = stmp & objRS("Year")& "<br>"

sPrevYear = objRS("Year")

end if

End Select

objRS.MoveNext

Wend

Response.Write stmp

%>

 

>From: John Pirkey 
>Reply-To: "Pro ASP HowTo" 
>To: "Pro ASP HowTo" 
>Subject: [proasp_howto] Re: Desperate Help Needed 
>Date: Thu, 23 Aug 2001 12:22:27 -0700 (PDT) 
> 
>you'll have to do some checking on the other types and if they are the same, then 
>dont print out the other sections. also, you'll have to build a string of the final 
>output and then only send it when you are done looping. something like this maybe: 
> 
> 
> 
>i can't really test this from work now, but i hope this gives you an idea of what 
>i'm talking about. i've done it using other similar data structures, with some 
>tweaking it should do what you want. yuo'll probably end up with some other flags 
>for new titles/authors/years combinations. 
> 
>good luck, 
> 
>john 
> 

  Return to Index