on 12-06-2019 4:48 PM
I have been working in Visual Studio 2017 with CR13SP25 and went to add another report. However, the 'Reporting' folder in the Toolbox was missing. Crystal Reports is also missing from the 'Add new' menu. I upgraded to CR13 SP26, which brought those menu items back but now it is throwing an error when trying to load the dataset. I reverted back to SP25, and printed the report just fine, but the menu items are missing again. The dataset is coming from an XML serialization (code posted below). Any idea on how to get this to work in either package?
CrystalDecisions.CrystalReports.Engine.DataSourceException: Error in File temp_7860d069-b58b-4be6-847f-941a1b6bd46d 9440_12448_{F0FC6F00-172F-45E1-A817-C49361900543}.rpt:
Failed to load database information. ---> System.Runtime.InteropServices.COMException: Error in File temp_7860d069-b58b-4be6-847f-941a1b6bd46d 9440_12448_{F0FC6F00-172F-45E1-A817-C49361900543}.rpt:
Failed to load database information.
at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault)
at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)
Source code:
namespace SORReceipts.Receipts
{
public partial class dspReceiptModify : Form
{
protected static string _username = System.Security.Principal.WindowsIdentity.GetCurrent().Name.Split('\\')[1];
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected static DataSet data = null;
public dspReceiptModify(ReceiptTransaction receipt)
{
log.Info("Printing Receipt Modified Started");
InitializeComponent();
log.Info(" -- InitializeComponent complete");
log.Info("Printing Receipt Modified Completed");
PrintReceipt(receipt);
}
public void PrintReceipt(ReceiptTransaction receipt)
{
receipt.DateStringForPrinting = receipt.TransactionDateStamp.ToString("MM/dd/yyyy h:mm tt");
receipt.DatePrinted = DateTime.Now.ToString("MM/dd/yyyy h:mm tt");
try
{
var xmlDocument = new XmlDocument();
var serializer = new XmlSerializer(receipt.GetType());
rptReceiptModify prntreceipt = new rptReceiptModify();
using (var stream = new MemoryStream())
{
serializer.Serialize(stream, receipt);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
xmlDocument.Load(stream);
}
var context = new XmlParserContext(null, new XmlNamespaceManager(new NameTable()), null, XmlSpace.None);
var reader = new XmlTextReader(xmlDocument.OuterXml, XmlNodeType.Document, context);
data = new DataSet();
data.ReadXml(reader);
SetPrinterSettings.SetPrinter(prntreceipt);
string printer = prntreceipt.PrintOptions.PrinterName.ToString();
prntreceipt.SetDataSource(data);
crystalReportViewer1.ReportSource = prntreceipt;
string _prntFileName = "Reciept_" + receipt.TransactionID.ToString() + "_" + receipt.DatePrinted.Replace("/", "_").Split(' ')[0];
prntreceipt.SummaryInfo.ReportTitle = _prntFileName;
prntreceipt.PrintToPrinter(1, false, 0, 0);
log.Info(" -- Receipt " + receipt.TransactionID.ToString() + "Printed");
crystalReportViewer1.ReportSource = null;
data.Reset();
}
catch (Exception ex)
{
LoggingHelper.Exceptionthrown("Failed to print Modified Receipt", ex);
if (UserMessaging.PrintFailed())
{
PrintBackupReceipt(data, receipt);
}
}
}
ONLY install the EXE onto your DEV PC, don't install the MSI packages.
Go to Programs and Features and verify you only have the CR for VS and 64 bit runtime package installed.
Did you remove the LegacyMode from the App.config file?
It's no longer required and can cause problems if used.
Also verify all assemblies in your project are now 13.0.4000.0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Don for your quick reply.
I think that it was the msi / exe problem. While I was waiting for a reply I uninstalled CR13SP25 rebooted, then I saw you replied so I installed the CR13SP26 exe version. Gave it a test and it worked without throwing an error.
I have Crystal Reports XI R2, and CR XI Release 2 .NET 2005 Server, CR runtime engine for .net and CR version for Visual Studio installed. I have to keep the CR XI R2 and server installs for other uses.
Did a text search for 'Legacy' in the App.config and nothing returned.
Assembles are 13.0.4000.0
Think its ok now, thank you for your help.
i have deinstalled both runtime and cr for visual studio, and then i have installed new, it works in vs2017 and vs2019!!
?????
i dont know why;
there mus be an error in update-procedure
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.