cancel
Showing results for 
Search instead for 
Did you mean: 

"Database logon failed" error while trying printing a document

Former Member
0 Kudos

Hi, recently I went from CR Basic for VS2008, to CR 13.0.2 (for VS 2010) on Windows 7 (64 bit) and Iam using .NET 4.5 framework.

In VS2008 all was working fine, now I get the "Database logon failed" error, and I DO NOT use any database! I only fill Parameter and Formula fields on the Crystal Report, and try to print it out. As mentioned, in VS 2008 all was woking OK, now its not. Why so??

Here is my simple code:

//passing data to parameters like (one example):

cr1.SetParameterValue("ParameterName", Actual_Parameter);

//and my code for prinitng:

PrintDocument doctoprint = new PrintDocument();

doctoprint.PrinterSettings.PrinterName = objPrinter.Value.ToString();

cr1.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.DefaultPaperSize;

CrystalDecisions.Shared.PageMargins margins = new CrystalDecisions.Shared.PageMargins(0, 0, 0, 0);

cr1.PrintOptions.ApplyPageMargins(margins);

crystalReportViewer1.ReportSource = cr1;

cr1.PrintToPrinter(1, false, 0, 0);  //and here i get the error!

Can someone help me out? I really have no idea what to do.

Mitja

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

What happens if you comment out the parameter line (cr1.SetParameterValue("ParameterName", Actual_Parameter); ) and let the report prompt?

Can you attach the report here? (Rename it to *.txt, hit the "Use advanced editor" and attach.

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

Former Member
0 Kudos

If I comment all the SetParameterValues its the same error.

I got this from the StackTrace:

at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)

   at CrystalDecisions.ReportSource.EromReportSourceBase.HandleException(Exception exception)

   at CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber(ReportPageRequestContext reqContext)

   at CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)

   at CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)

   at FrizerskiSalon2014.PrintBill..ctor(DataCompany _c, DataOrder _o, DataLogin _l)

PS: what did you mean by "Can you attach the report here? (Rename it to *.txt, hit the "Use advanced editor" and attach."? Where can I get the report?

What would it mean, do you have any clue? But keep in mind that all the code was working fine in CR for VS2008 Basic.

PS2: you know what is funny? I have two other Reports to print (different ones) but with the exact same code as this one from 1st post, and printing works! I dont know why it doesnt this one.

Former Member
0 Kudos

I dont know what was wrong, but it would be hard to fix.

I simply did a new CR, with copying all the fields from the old to the new one. And now works fine.

Really strange error. But it surely has something to do with the migration from the old to the new CR, while using FormulaFields or ParameterFields.

Former Member
0 Kudos

@Ludek Uher:

What do you think this error comes from? It has to do with "incomplete" transformation from VS2008 to VS2010 and CR respectively.

former_member183750
Active Contributor
0 Kudos

I can not say. Like I mentioned earlier, it would have been good to have one of the reports that works and the one that does not. I could have compared, see if there was anything amiss. You mention that re-creating the report resolved the issue(?). That may point to some sort of a corruption of the report - unless the connection info is not identical between the reports.

- Ludek

Answers (0)