Hello everybody,
I need to print existing Crystal Report from my application. What I have:
ReportClass myReport = new ReportClass();
myReport.FileName = “C:\…some path to the report file”;
myReport.SetDatabaseLogon(“userid”, “password”, “server”, “database”);
myReport.PrintOptions.PrinterName = “some printer”;
m_ myReport.PrintToPrinter(1, false, 0, 0);
Some problem appears in SetDatabaseLogon(...) function. It returns error:
“Unable to connect: incorrect log on parameters”,
which is absolutely wrong message, because all parameters are OK.
For debugging purpose I just hard coded “userid”, “password”, “server”, “database” while using SetDatabaseLogon function. And without any problem using these parameters I could login to Query Analizer or Management studio, also I could open the report and create new connection using these “userid”, “password”, “server”…
Does anybody has any idea what am I missing? What am I doing wrong?
Thank you in advance,
Alex
AlexPosted Mar 5, 2009, 2:35 PM
For those who might be interested I’ve solved this problem:
Instead of calling SetDatabaseLogon(...) (still don’t understand why this function didn’t work) I set logon info to all tables of the report and all tables of sub reports (if any).
Regards,
Alex
AlexPosted Feb 27, 2009, 12:27 PM
Thanks Mahesh for your reply, but I cannot believe it that this is the only way to display existing reports using C# Crystal Report classes. Because my application has to show reports created independantly. So every time new report added I have to rebuild my applicaton? If you are right, I may have to look for another way to work with Crystal Reports. Too bad, but I still cannot believe that this C# feature are so week.
Anyway, I'll try to add this report to my project and see if this will solve the problem.
Thanks again for you reply,
Alex
Mahesh ChandPosted Feb 26, 2009, 5:18 PM