?
Solved

crystal reports requests password every time I start application

Posted on 2013-01-26
3
Medium Priority
?
366 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 101

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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

762 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