You are currently browsing the tag archive for the ‘Logon Prompt Problem’ tag.

Before I can proceed with this tutorial I assume that the reader has already developed a report in crystal and has loaded it in crystal report viewer control. Running the website and the report page prompts the user with something like this.

Crystalreports Login Prompt

Crystalreports Login Prompt

Now we don’t want to give login information every time we try to run this report.  Its annoying . so what we need to do is to do something with the help of which we can get our report perfectly without this stupid prompt. To solve this problem we will provide the login information programmatically so that our report page don’t prompt us for it. To solve the problem I have done the following. Add the following code to the top of the report page.


using CrystalDecisions;

using CrystalDecisions.CrystalReports;

usingCrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;

Now in the Page_Load()  event write the following code. Or we can write this code in any other function and call it when we want to provide the login information.

 

Now in the Page_Load()  event write the following code. Or we can write this code in any other function and call it when we want to provide the login information.


ReportDocument rpt = new ReportDocument();

rpt.Load(Server.MapPath("myReport.rpt"));

rpt.SetDatabaseLogon("myUserLogin", "mypassword", @"Server", "Database");

CrystalReportViewer1.ReportSource = rpt;

Save the page and run the report. This time it will not prompt for the stupid logon information. If some one wants a very basic article on how to create a report and how to call it in asp.net. plz leave your comments . I will write a basic tutorial for creating a crystal report and calling it from asp.net.

Note:- Plz  leave ur comments if this article was helpful.

Thanks.

 

Advertisements

Blog Stats

  • 331,044 hits

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 233 other followers

%d bloggers like this: