Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling for Crystal Report

Status
Not open for further replies.

Nabin

Programmer
Mar 14, 2002
3
IN
Hello,
I am trying to do Exception Handling in the C# code(.NET environment)for an Web Application. I want to catch a Crystal Report Exception(Formula exception) by using "try-catch" block.
But I am not able to catch the exception. Surprisingly, the code is not entering into the catch block at all.I am getting the usual error page (which we get without doing the exception handling).
It will be of great help for me, if someone can help me on this.

Thanks,
Nabin

For the reference, I am attaching the piece of code, I am using.

Button1_Click(object sender, System.EventArgs e)

{
try

{
string sConnectionString = ConfigurationSettings.AppSettings["SCMSdsn"];
m_oConn = new SqlConnection(sConnectionString);
m_oAdapter = new SqlDataAdapter("spr_Rpttest", m_oConn);
m_oAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;
m_oAdapter.SelectCommand.Parameters.Add(new SqlParameter("@User",SqlDbType.NVarChar,30));
m_oAdapter.SelectCommand.Parameters["@User"].Value = Testbox1.Text;


dsMydataset oDS = new dsMydataset();
m_oAdapter.Fill(oDS, tbl_mytable);
m_oReportDocument.SetDataSource(oDS);

//m_oReportDocument is declared as, "protected CrystalReport1 crReportDocument=new CrystalReport1();"

CRV.ReportSource = m_oReportDocument;

//CRV is declared as, "protected CrystalDecisions.Web.CrystalReportViewer CRV";

}


catch(CrystalDecisions.CrystalReports.Engine.FormulaException e)
{
lblMessage.Text="Incorrect Formula used.";
}
}

 
I want to revive this post. I am having the same issue with error handling and the Crystal Reports engine. I have exposed a report through a web service (as per Crystal Decisions white paper) and am using a client web applicatio to access the report. I cannot trap any of the engine's exceptions through try/catch blocks, Application_Error() or Page_Error methods.

I have read the MSDN article on how to handle Crystal Report Engine errors, but it suggests that I should used the HandleException() of the CrystalReportViewer but there is no method for this class in Web applications (only on window form applications) [mad] .

How do I catch these errors from the Crystal Reports engine from a web service?

 
Hi Peener,
I was not able to solve this issue. But I know one of my friend has done this successfully. I will try to get some details from him & post it.

Thanks,
Nabin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top