Solved

crystal reports requests password every time I start application

Posted on 2013-01-26
3
363 Views
Last Modified: 2013-01-26
Hi

I am very new to crystal reports, and I am going to use it in an application I am developing.  It is a c# 2010 winforms application  that connects to an MS Access database which is password protected.

When I go through the process of adding a report (at design time), it requests the password and accepts it.. everything works as expected, I can select a query and produce a report based on that. Great.

But then at runtime, when I click a button I created to display the report, it requests the password again? yikes... why is this not stored in the connection details?  Clearly I don't want the end users to be entering the password for the database...

Any idea how I can prevent this, I don't really want to remove the password from the database.

Cheers

CD
0
Comment
Question by:cycledude
  • 2
3 Comments
 

Accepted Solution

by:
cycledude earned 0 total points
ID: 38821666
I have the solution now:

ReportDocument cryRpt = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            Tables CrTables;

            cryRpt.Load(PathToReports + "\\CrystalReport1.rpt");


            crConnectionInfo.ServerName = "YOUR SERVER NAME";
            crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
            crConnectionInfo.UserID = "YOUR USERNAME";
            crConnectionInfo.Password = "YOUR PASSWORD";

            CrTables = cryRpt.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh(); 

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();

Open in new window

0
 

Author Closing Comment

by:cycledude
ID: 38821667
got it easy enough...
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 38822162
For security reasons Crystal doesn't store the password.  If it id all I need is the report file and I can get access to the database.

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question