473,382 Members | 1,225 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Crystal Reports 8.5 with C# problem

Hi all, I have a piece of code in my C# console application to export from
crystal report files to PDF. For some reports files, I get errors below. I
have Crystal Reports 8.5 with service pack installed on my local machine.
What is the reason to cause this "Unknown Query Engine Error"? This is a
report with 3 sub-reports, is there anything missing in my code to handle
this type of reports?

Thanks a lot!

=====================Error Call Stack Begins============================
Error Message: Unknown Query Engine Error
Error Source: CrystalDecisions.CrystalReports.Engine
Error Stack Trace: at .F(String  , EngineExceptionErrorID  )
at .A(Int16 , Int32 )
at .@(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngin e.Export(ExportRequestContext
at CrystalDecisions.CrystalReports.Engine.FormatEngin e.Export()
at CrystalDecisions.CrystalReports.Engine.ReportDocum ent.Export()
at MyApp.MyClass.CrystalReportsNet.exportReport(Strin g reportPath, String
reportNameCode, DateTime startDate, DateTime endDate, Int32 saveOrPrint,
ReportDocument rd) in c:\work\crystalreportsnet.cs:line 258
Error TargetSite: Void F(System.String,
CrystalDecisions.CrystalReports.Engine.EngineExcep tionErrorID)
ErrorID: DataSourceError
HelpLink: NULL

=======================Souce Code Begins Here========================
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
ReportDocument rd = new ReportDocument();

ParameterFieldDefinitions crParams = rd.DataDefinition.ParameterFields;
foreach (ParameterFieldDefinition def in crParams) {
if (def.IsLinked()) {
string paramName = def.ParameterFieldName;

// create new Parameter Discrete Value object
ParameterDiscreteValue paramValue = new ParameterDiscreteValue();

// Set value of Discrete value object
switch (paramName.ToUpper()) {
case "@DEALERID":
paramValue.Value = dealerID;
paramValue.Value = languageID;
paramValue.Value = MPAReportType;
case "@RPTMONTH":
paramValue.Value = month;
case "@RPTYEAR":
paramValue.Value = year;
paramValue.Value = month;
paramValue.Value = year;

// extract collection of current values
ParameterValues currentValues = def.CurrentValues;

// Add Discrete value object to collection of current values

// apply modified current values to param collection

foreach (Section sec in rd.ReportDefinition.Sections) {
foreach (ReportObject report in sec.ReportObjects) {
if (report.Kind == ReportObjectKind.SubreportObject) {
SubreportObject subreport = (SubreportObject)report;
ReportDocument subRepDoc =

foreach (Table tbl in subRepDoc.Database.Tables) {
TableLogOnInfo tliCurrent = tbl.LogOnInfo;
tliCurrent.ConnectionInfo.ServerName = "MyODBC";
tliCurrent.ConnectionInfo.DatabaseName = "MyDatabase";
tliCurrent.ConnectionInfo.UserID = "MyUsername";
tliCurrent.ConnectionInfo.Password = "MyPassword";

foreach (Table tbl in rd.Database.Tables) {
TableLogOnInfo tliCurrent = tbl.LogOnInfo;
tliCurrent.ConnectionInfo.ServerName = "MyODBC";
tliCurrent.ConnectionInfo.DatabaseName = "MyDatabase";
tliCurrent.ConnectionInfo.UserID = "MyUsername";
tliCurrent.ConnectionInfo.Password = "MyPassword";

try {
DiskFileDestinationOptions save = new DiskFileDestinationOptions();
save.DiskFileName = @"c:\temp\a.pdf";
ExportOptions exp = new ExportOptions();
exp = rd.ExportOptions;
exp.ExportDestinationType = ExportDestinationType.DiskFile;
exp.ExportFormatType = ExportFormatType.PortableDocFormat;
exp.DestinationOptions = save;

return true;
} catch {

WWW: http://hardywang.1accesshost.com
ICQ: 3359839
yours Hardy
Dec 7 '05 #1
1 3531
Hi Hardy,

The Crystal Report is a third-party software integrated with the VS.NET
IDE, and it is not supported by Microsoft, please refer to the following KB
article for the information on the licensing and support on Crystal Report:
INFO: Licensing and Support for Crystal Reports for Visual Studio .NET

If you have more concern on this issue, I suggest you contact crystal
report support for help:

And the following is the Forum where you will receive some specific helps:

Thanks for your understanding!
Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no

Dec 8 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: kristoff plasun | last post by:
I have a problem with a C++ DCOM application that prints Crystal Reports with data from Oracle. The SQL query is relatively complex but when the report is printed from the Crystal Reports...
by: Gheaci Maschl | last post by:
Hi all! I would like to have your opinion about my problem and my proposal how to solve it: Ingredients: - BTriev database - Crystal Reports - maybe MS Access - Liinos6 (small ERP software)
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
by: John | last post by:
I am using Crystal Reports in my application I made using Visual Studio.NET. I installed my application on the client machine, with all the DLLs required(added the merge modules), the engine and...
by: fig000 | last post by:
Hi everyone, I recently wrote a vb.net app which includes some crystal reports. The user has very little money in their budget and have been without a working application for quite a while. This...
by: Peter Proost | last post by:
Hi Group, I've got an interesting problem, I don't know if this is the right group but I think so because everything I've read about it so far says it's a .net problem. Here's the problem, we're...
by: Lyners | last post by:
Hello all, I have created an ASP.NET website that uses Crystal Reports that works on the localhost (my PC), but when I copy it to the server it does not. The problem is...
by: matt | last post by:
hello, i have an .RPT file that i am using to load a report via the ASP.NET CrystalReportViewer control. i dont include my .RPTs as embedded resources...instead i load the absolute path of the...
by: appandairajc | last post by:
Hi Friends, I have a problem in Crystal Reports. I have a web application and it was published in machine. I am running that application through a virtual path. All the pages are...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.