I have read with interest the posts relating to Crystal Report integration and the problem I am experiencing would seem to relate to the target framework.
Crystal Reports seems to support up to Dot Net Framework 4.0 with WiseJ supporting from Dot Net Framework 4.5 on.
In would see no issue in using the Crystal Report viewer (as I did with Visual Web Gui) if either WiseJ supported Dot Net Framework 4.0 (in an attempt to get the report viewer to work I dropped the framework to 4.0 and WiseJ failed to work).
I have attempted to integrate in bot VS2012 / Vs2013 and VS2015 but with no success.
Does anyone have any suggestions, other than waiting for Crystal Reports to support Dot Net Framework 4.5 and above.
Thanks
Andrew
Try starting a project in .Net 2 – then add the references, then switch back. I’ve had this trouble since using .Net 4 years ago! Be careful with losing other references etc though. I’ve even taken to copying references from a working project into new ones by editing the csproj file!
Here’s an example of what I copy across into the <ItemGroup> section in the project file. We’re using 13.0.24 so the Version number may differ on your system:
This configuration has worked for me and is in production with customers (not clean and neat, but functional – And before you knock my code style, please remember that I was brand new to coding in C# when this was originally written):
Notes: Even though there are later versions I keep my Crystal at version 13 across sites (since I still have VB sites and VS2013 developed systems out there)
Hope this helps someone.
Couldn’t attach so code for report.aspx.cs below:
using System; using System.Data; using CrystalDecisions.Web; using CrystalDecisions.CrystalReports.Engine; namespace MyApp { public partial class report : System.Web.UI.Page { ReportDocument viewerSource = null; protected void Page_Load(object sender, EventArgs e) { string qsXmlFilename = Request.QueryString["xfn"]; string qsViewerSource = Request.QueryString["vs"]; Type t = Type.GetType(qsViewerSource); viewerSource = (ReportDocument)Activator.CreateInstance(t); clsReporting.printSetViewer(viewerSource, qsXmlFilename); crystalReportViewer.ReportSource = viewerSource; crystalReportViewer.DisplayStatusbar = false; crystalReportViewer.DisplayToolbar = true; crystalReportViewer.EnableDrillDown = false; crystalReportViewer.EnableDatabaseLogonPrompt = false; crystalReportViewer.EnableParameterPrompt = false; crystalReportViewer.EnableToolTips = false; crystalReportViewer.HasCrystalLogo = false; crystalReportViewer.HasDrilldownTabs = false; crystalReportViewer.HasDrillUpButton = false; crystalReportViewer.HasPageNavigationButtons = true; crystalReportViewer.HasToggleGroupTreeButton = false; crystalReportViewer.HasToggleParameterPanelButton = false; crystalReportViewer.PrintMode = CrystalDecisions.Web.PrintMode.Pdf; crystalReportViewer.SeparatePages = false; crystalReportViewer.ShowAllPageIds = false; crystalReportViewer.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; } // Usually this would be somewhere else in your project, not in the report.aspx.cs code behind public static void printSetViewer(ReportDocument objReport, string tmpFile) { string tmpPath += "~\tempreports"; DataSet ds = new DataSet(); ds.ReadXml(tmpPath + @"\" + tmpFile + ".xml"); //Temp XML file is created on server by another process objReport.Load(objReport.FileName.ToString()); objReport.SetDatabaseLogon("", "", tmpFile, ds.DataSetName.ToString()); objReport.SetDataSource(ds); ConnectionInfo crConnInfo = new ConnectionInfo(); crConnInfo.ServerName = tmpFile; crConnInfo.DatabaseName = ds.DataSetName.ToString(); crConnInfo.UserID = ""; crConnInfo.Password = ""; crConnInfo.Type = ConnectionInfoType.MetaData; TableLogOnInfo tblTempLogonInfo = new TableLogOnInfo(); // This prevent the frustrating Database Login Errors foreach (Table tbl in objReport.Database.Tables) { tblTempLogonInfo = tbl.LogOnInfo; tblTempLogonInfo.ConnectionInfo = crConnInfo; tblTempLogonInfo.TableName = tbl.Name; tblTempLogonInfo.ReportName = objReport.Name; tbl.ApplyLogOnInfo(tblTempLogonInfo); tbl.Location = tbl.Name; tbl.SetDataSource(ds.Tables[tbl.ToString()]); } } }
Hi Thomas,
I’m running Crystal Reports 13 and have tried all service packs (currently sp 19)
In particular it’s the Crystal Reports Viewer I am having trouble with – just cant seem to get it as an object in the toolbox.
I have done this without trouble in Visual Web Gui which is somewhat similar to WiseJ
Thanks for your help.
Andrew
Hi Andrew,
which version of Crystal Reports are you using?
Best wishes
Thomas
Please login first to submit.