Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Crystal


Message #1 by "Jorge Horacio Carnovale" <carnovalej@h...> on Mon, 26 Feb 2001 16:50:30 -0300
Have anyone used Crystal Reports 6 for ASP? Could please send me a quick

sample?

Message #2 by "Amitabh" <amitabh@k...> on Mon, 26 Feb 2001 23:40:31
HI,



here is a basic code in which the report is not using any parameters.



amitabh



<HTML>

<HEAD>

<TITLE>Sample CR ASP Page</TITLE>

</HEAD>

<BODY>



<%



reportname = "QuarterlySalesByRegion.rpt"



' create the CR object, we are checking here to

' avoid multiple instances . one Application is created for

' a session







If Not IsObject ( session ("oApp")) Then                              

Set session ("oApp") = Server.CreateObject("Crystal.CRPE.Application")

End If                                                                





' code for obtaining the physical path of the document root

' this returns usually C:\InetPub\Wwwroot\Crysta\Reports\ etc.

' may be different depending upon ur installation



Path = Request.ServerVariables("PATH_TRANSLATED")                     

While (Right(Path, 1) <> "\" And Len(Path) <> 0)                      

 iLen = Len(Path) - 1                                                  

 Path = Left(Path, iLen)                                               

Wend                                                                  

 



'setting the report name 

Set session("oRpt") = session("oApp").OpenReport(path & ReportName, 1)

                         

                                             

' Turning off report error messages                            

Set oRptOptions = Session("oRpt").Options                             

oRptOptions.MorePrintEngineErrorMessages = 

0                                                 





On Error Resume Next                                                  

session("oRpt").ReadRecords                                           

' this is where ur report connects to DB and starts reading ur records



If Err.Number <> 0 Then                                               

  Response.Write "An Error has occured on the server "

Else                                                                  

' Successful, so create the page 

engine                                                                  

Set session("oPageEngine") = session("oRpt").PageEngine               

End If                                                                



'Include the Smart Viewer of ur choice

                                                                    

<!-- #include file="SmartViewerJava.asp" --

>                                                                  



' if u go for Activex, use ,   file="SmartViewerActiveX.asp       



%>













> Have anyone used Crystal Reports 6 for ASP? Could please send me a quick

> sample?


  Return to Index