Hi,
I have a crystal report that contains several sub reports. Now within the crystal reports IDE the report works correctly and all sub reports are generated and variables that were entered into the first main report are persisted to the sub reports. When i generate the report from my ASP.Net page and generate the report as a PDF, some of the sub reports get generated while 2 of them do not, and when i profile it in SQL it is as if the variables are not being passed to the sub report??? it did work a little while ago, so i am quite unsure how this has happened????
my code is:
Has anyone got an ideas??
THanks Rob
---------------------------------------
I have a crystal report that contains several sub reports. Now within the crystal reports IDE the report works correctly and all sub reports are generated and variables that were entered into the first main report are persisted to the sub reports. When i generate the report from my ASP.Net page and generate the report as a PDF, some of the sub reports get generated while 2 of them do not, and when i profile it in SQL it is as if the variables are not being passed to the sub report??? it did work a little while ago, so i am quite unsure how this has happened????
my code is:
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Load Report
cr.Load(ConfigurationSettings.AppSettings("report"))
'Perform Crystal Reports Login
DoCRLogin(cr)
'Pass Parameters and Set Report Source
cr.SetParameterValue("jobcode", Request.Params("JobCode"))
'cr.SetParameterValue("dateFrom", CDate(Request.Params("dFrom")))
'cr.SetParameterValue("dateTo", CDate(Request.Params("dTo")))
'cr.SetParameterValue("DateFrom2", CDate(Request.Params("dFrom2")))
'cr.SetParameterValue("DateTo2", CDate(Request.Params("dTo2")))
cr.SetParameterValue("dateFrom", CDate("02/01/2006"))
cr.SetParameterValue("dateTo", CDate("02/07/2006"))
cr.SetParameterValue("DateFrom2", CDate("03/07/2006"))
cr.SetParameterValue("DateTo2", CDate("31/12/2006"))
cr.SetParameterValue("FullPeriodStart", CDate(Request.Params("dFrom")))
cr.SetParameterValue("FullPeriodEnd", CDate(Request.Params("dTo2")))
cr.SetParameterValue("@Section1", 1)
cr.SetParameterValue("@Section2", 2)
cr.SetParameterValue("Currency", "£")
ExportReport()
End Sub
Public Sub DoCRLogin(ByRef oRpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)
Dim _applyLogin As New ApplyCRLogin
' use ApplyLogin object to apply login info to all tables in CR object
_applyLogin._dbName = ConfigurationSettings.AppSettings("dbName")
_applyLogin._passWord = ConfigurationSettings.AppSettings("password")
_applyLogin._serverName = ConfigurationSettings.AppSettings("servername")
_applyLogin._userID = ConfigurationSettings.AppSettings("userid")
_applyLogin.ApplyInfo(oRpt)
' clean up
_applyLogin = Nothing
End Sub
Sub ExportReport()
Dim oStream As New MemoryStream ' // using System.IO
' Select Case format
' Case "PDF"
oStream = cr.ExportToStream( _
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat)
Response.ClearContent()
Response.ClearHeaders()
Response.Buffer = True
Response.ContentType = "application/pdf"
'--------------------------------------------------------------
Try
Response.BinaryWrite(oStream.ToArray())
Response.Flush()
Response.Close()
Catch err As Exception
Response.Write("< BR >")
Response.Write(err.Message.ToString)
End Try
End Sub
Has anyone got an ideas??
THanks Rob
---------------------------------------