Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: Database Logon Fail Post Reply Post New Topic
Page  of 2 Next >>
Author Message
rushelp
Newbie
Newbie


Joined: 25 Jun 2012
Online Status: Offline
Posts: 19
Quote rushelp Replybullet Topic: Database Logon Fail
    Posted: 02 Aug 2012 at 6:34am
Hi,

I have a crystal report file which generates reports for each clients monthly. Each month the crystal report file should be refreshed. I could manually refresh the file, however I have many crystal reports, it's pain to refresh all of them manually on the first of each month.

After I did some research I found out, if I uncheck the option "save data with report" it should refresh the crystal file.

I have a program that converts crystal to pdf. If I uncheck that option and try to convert the file I get the following error: "Database logon failed".

Any help on how I can resolve this issue?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 02 Aug 2012 at 9:00am
Your program would have to be updated to "refresh" the report prior to trying to export it.
 
-Dell
IP IP Logged
rushelp
Newbie
Newbie


Joined: 25 Jun 2012
Online Status: Offline
Posts: 19
Quote rushelp Replybullet Posted: 02 Aug 2012 at 9:28am
What do you mean?

Edited by rushelp - 02 Aug 2012 at 9:39am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 02 Aug 2012 at 9:40am
I assume you're already loading the report into a ReportDocument to export to PDF.  You would have to walk through the ReportDocument.DataSourceConnections collection and set the user ID and password for each connection.  If your report contains subreports, you'll also have to walk through the ReportDocument.Subreports collection, casting each subreport as a ReportDocument and setting the connections there as well.
 
From there ExportToPDF should refresh the report prior to export.
 
-Dell
IP IP Logged
rushelp
Newbie
Newbie


Joined: 25 Jun 2012
Online Status: Offline
Posts: 19
Quote rushelp Replybullet Posted: 02 Aug 2012 at 11:01am
So this is how I load my file. And yes, I did not had my connections to database. I added.
So this is what I have, however I get a dofferemt error.

string fileName = Path.GetFileName(reportPath);
ReportDocument report = new ReportDocument();
report.Load(reportPath);
//added this line
report.SetDatabaseLogon("User", "Pass", "Server", "Database");

"Missing parameter values".

Edited by rushelp - 02 Aug 2012 at 11:23am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 03 Aug 2012 at 7:07am
If your report has parameters, you'll have to set them in code as well.  Use ReportDocument.Parameter fields to do this.
 
-Dell
IP IP Logged
rushelp
Newbie
Newbie


Joined: 25 Jun 2012
Online Status: Offline
Posts: 19
Quote rushelp Replybullet Posted: 03 Aug 2012 at 7:13am
That's what I've been trying to figure out all day. I do not pass any parameters from C# to Crystsal.
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 03 Aug 2012 at 7:34am
But if you had parameters when you were manually running the report to save the data, what were they?
 
-Dell
IP IP Logged
rushelp
Newbie
Newbie


Joined: 25 Jun 2012
Online Status: Offline
Posts: 19
Quote rushelp Replybullet Posted: 03 Aug 2012 at 7:41am
Going back to my first posts in here...

I had one big report that contained report for hundred clients. I needed somehow to separate it. I wrote a formula in crystal file where in that big report I can specify the client by it's ID. So what I was doing is running big report each time and when I get the client I need I saved it as to get one crystal file for that client, and then went to different client. That's how I get the report for all my clients.

Now when I think, the reason it's asking for the parameter is that I was entering them in crystal reports when I was doing {ContactInfo.ClientID} = {My_Parameter}.

And manually choosing parameter from the list I had. It's working this way, but only when it comes to REFRESH reports I get this.



Edited by rushelp - 03 Aug 2012 at 7:42am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 03 Aug 2012 at 7:57am
You're getting this because you're no longer working with saved data.  You will have to set this parameter in code.  However, you could always load a DataSet that contains all of the client ID's you want to run the report for, walk through the data set and do a separate export for each client instead of running just one big report.
 
-Dell
IP IP Logged
Page  of 2 Next >>
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.015 seconds.