Solved

crystal reports requests password every time I start application

Posted on 2013-01-26
3
362 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

776 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