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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR: Logon failed

Status
Not open for further replies.

lutzs

Programmer
Oct 8, 2002
75
LU
Hi,

i have an ado.net dataset. With crystal reports i can view this dataset.
Now, i will export the report to pdf.

The programm is running but get this error message:

An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.LogOnException' occurred in crystaldecisions.crystalreports.engine.dll

Additional information: Logon failed.

What can I do?
The logon with the ado.net is successfully. And then i will export the created report.

Thanks,
Stephanie
 
Hi,

i'm using an Oracle Database.
I use the OleDb Connection (using the ado.net dataset).

oRpt = new CrystalReport1 ();
crystalReportViewer1.ExportReport();

OleDbConnection oleConn = new OleDbConnection ("Provider=MSDAORA.1;Password=pwd;User ID=user;data Source=datasource");

OleDbDataAdapter oleAdapter = new OleDbDataAdapter("SELECT * FROM i_cus", oleConn);

Dataset1 dataSet = new Dataset1();

oleAdapter.Fill (dataSet, "i_cus");

oRpt.SetDataSource (dataSet);

crystalReportViewer1.ReportSource = oRpt;


//-------------- EXPORT -----------------
string exportFilePath = "c:\\exported_report.pdf";

CrystalReport1 crReport = new CrystalReport1();
ReportDocument crReportDocument = new ReportDocument();
crReportDocument.Load("C:\\CrystalReport1.rpt");

DiskFileDestinationOptions crDiskFile = new DiskFileDestinationOptions();
crDiskFile.DiskFileName = exportFilePath;

ExportOptions crExportOptions = new ExportOptions();
crExportOptions = crReportDocument.ExportOptions;
crExportOptions.DestinationOptions = crDiskFile;

crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

crReportDocument.Export();

}


Thanks,
Stephanie
 
Looks like you're loading your rpt file. Try loading the instance of your report you already declared.
 
How can I do that?

> crReportDocument.Load(oRpt);

I get this error messages:
"The best overloaded method match for 'CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(string)' has some invalid arguments"
cannot convert from 'reporting_off_ado.net_datasets.CrystalReport1' to 'string'

I dont't know.

Thanks,
Stephanie

 
Use your report instance (crReport) to export. As in crReport.export(). Try it without making that reportDocument object. That works for me.
 
The error message:

An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.LogOnException'occurred in crystaldecisions.crystalreports.engine.dll

Additional information: Logon failed.


I think, the code is correct:

string exportFilePath = "c:\\exported_report.pdf";

CrystalReport1 crReport = new CrystalReport1();

DiskFileDestinationOptions crDiskFile = new DiskFileDestinationOptions();
crDiskFile.DiskFileName = exportFilePath;

// Exporting information
ExportOptions crExportOptions = new ExportOptions();
crExportOptions = crReport.ExportOptions;
crExportOptions.DestinationOptions = crDiskFile;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

crReport.Export();


Why does it works for you?

Stephanie
 
Hi,

The error message:

An unhandled exception of type 'CrystalDecisions.CrystalReports.Engine.LogOnException'occurred in crystaldecisions.crystalreports.engine.dll

Additional information: Logon failed.


I think, the code is correct:

string exportFilePath = "c:\\exported_report.pdf";

CrystalReport1 crReport = new CrystalReport1();

DiskFileDestinationOptions crDiskFile = new DiskFileDestinationOptions();
crDiskFile.DiskFileName = exportFilePath;

// Exporting information
ExportOptions crExportOptions = new ExportOptions();
crExportOptions = crReport.ExportOptions;
crExportOptions.DestinationOptions = crDiskFile;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

crReport.Export();


Why does it works for you?

Stephanie
 
I don't know why it works for me and not for you. I use SQL Server. Maybe Oracle does not cache your logon when you write apps in .Net.

Can you display the report at all? Does that work? If so, try that, and try pressing the viewer's export button and see if you can save it from there. Kind of narrow down the problem, if you know what I mean.
 
Yes, i can display the report at all.

I pressed the viewer's export button: i can choose a filepath and a file name- and then:
"Error in file C:\Docum~1 ...\.rpt
Operation not yet implemented".
"Export failed".

Is there a problem with Crystal Reports?

Thanks,
Stephanie
 
Are you sure you haven't deleted anything in the underlying c# code for your .rpt file?
 
Yes, I'm sure.
I've created a dataset with ado.net and a crystal reports with two field of my database.

Am I to again provide the whole project?

Stephanie
 
Even with the whole code, its still hard to see what is going on without running the project and getting the errors myself. And even harder to diagnosis when it looks like you're not doing anything wrong. So all that I can do is offer some suggestions.

Not to mention that you do it a slightly different way than me. For example, I make a dataAdapter object, then assign its select command to a command that I have already made, add the table mappings after that. But I doubt that that would cause the error you are getting.

Also, what did you originally design the crystal report with as the source? I sometimes use an xml file and delete the xml file after I'm done designing. It doesn't seem to mind that the source is different and I set the source to a dataset.

It reminds me of a problem I had using CR in VB 6 wherein I would import a .rpt file that used SQL Server in other Data Sources for the source, and would have trouble logging on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top