Hi,
I am developing an ASP.NET web application that uses CR 10 for reporting. I developed an ASP.NET page that calls rpt files developed outside the project. The page sends server names and other parameters to the rpt file. However, while trying to display reports, CR is looking for the server that was originally used to develop reports. The code looks like the following:
Private Sub ShowReport()
Try
Dim reportObj As ReportDocument = New ReportDocument
Dim reportFileName As String
If ReportParams.Language = "ENGLISH" Then
reportFileName = ReportParams.ReportFile + "_E.rpt"
Else
reportFileName = ReportParams.ReportFile + "_B.rpt"
End If
reportFileName = Server.MapPath(reportFileName)
If Not File.Exists(reportFileName) Then
Throw New ApplicationException("Report file not found at: " + reportFileName + ".")
End If
reportObj.Load(reportFileName)
If ReportParams.ShowFiscalYear Then
reportObj.SetParameterValue("@FiscalYear", ReportParams.FiscalYear)
End If
If ReportParams.ShowLegal Then
reportObj.SetParameterValue("@LegalID", ReportParams.LegalCode)
End If
reportObj.SetParameterValue("@MinistryID", ReportParams.MinistryID)
If ReportParams.ShowFuncUnit Then
reportObj.SetParameterValue("@FunctionID", ReportParams.FuncID)
End If
If ReportParams.ShowOperUnit Then
reportObj.SetParameterValue("@OpunitID", ReportParams.OperID)
End If
reportObj.SetParameterValue("@StartingPage", ReportParams.StratingPage)
reportObj.SetDatabaseLogon(DBConnection.GetIBudgetUserID, DBConnection.GetIBudgetPassword, _
DBConnection.GetIBudgetDataSource, DBConnection.GetIBudgetInitialCatalog, True)
CrystalReportViewer1.ReportSource = reportObj
Catch appEx As ApplicationException
Throw appEx
Catch ex As Exception
Throw New Exception("Problem has occured while generating report.")
End Try
End Sub
Can anyone help?
Regards.
Mohaimen
I am developing an ASP.NET web application that uses CR 10 for reporting. I developed an ASP.NET page that calls rpt files developed outside the project. The page sends server names and other parameters to the rpt file. However, while trying to display reports, CR is looking for the server that was originally used to develop reports. The code looks like the following:
Private Sub ShowReport()
Try
Dim reportObj As ReportDocument = New ReportDocument
Dim reportFileName As String
If ReportParams.Language = "ENGLISH" Then
reportFileName = ReportParams.ReportFile + "_E.rpt"
Else
reportFileName = ReportParams.ReportFile + "_B.rpt"
End If
reportFileName = Server.MapPath(reportFileName)
If Not File.Exists(reportFileName) Then
Throw New ApplicationException("Report file not found at: " + reportFileName + ".")
End If
reportObj.Load(reportFileName)
If ReportParams.ShowFiscalYear Then
reportObj.SetParameterValue("@FiscalYear", ReportParams.FiscalYear)
End If
If ReportParams.ShowLegal Then
reportObj.SetParameterValue("@LegalID", ReportParams.LegalCode)
End If
reportObj.SetParameterValue("@MinistryID", ReportParams.MinistryID)
If ReportParams.ShowFuncUnit Then
reportObj.SetParameterValue("@FunctionID", ReportParams.FuncID)
End If
If ReportParams.ShowOperUnit Then
reportObj.SetParameterValue("@OpunitID", ReportParams.OperID)
End If
reportObj.SetParameterValue("@StartingPage", ReportParams.StratingPage)
reportObj.SetDatabaseLogon(DBConnection.GetIBudgetUserID, DBConnection.GetIBudgetPassword, _
DBConnection.GetIBudgetDataSource, DBConnection.GetIBudgetInitialCatalog, True)
CrystalReportViewer1.ReportSource = reportObj
Catch appEx As ApplicationException
Throw appEx
Catch ex As Exception
Throw New Exception("Problem has occured while generating report.")
End Try
End Sub
Can anyone help?
Regards.
Mohaimen