• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

crystal reports requests password every time I start application

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
cycledude
Asked:
cycledude
  • 2
1 Solution
 
cycledudeAuthor Commented:
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
 
cycledudeAuthor Commented:
got it easy enough...
0
 
mlmccCommented:
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now