0
votes

In asp.net 4.0, when we create report in Crystal Reports using ADO.NET objects, we face a problem that after successfully creating the report preview, the report wants a user id and password for SQL Server. How can I solve this?

When I want to attached ADO.NET object in Crystal Reports it wants an XML file. How can I configure or connect it?

2

2 Answers

0
votes

Hey Please refer this code to Resolve your Problem

protected void Page_Load(object sender, EventArgs e)
{
ReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
crystalReport.SetDatabaseLogon("username", "password", @"server name", "DB name");
CrystalReportViewer1.ReportSource = crystalReport;
}

hope it will help

0
votes

If you are getting this after deployee, than you might have reporting server running in same server same port same folder (default port 80, default folder "reports")

to resolve you can do one of

1) Change you name of your reports folder name other than "reports"

or

2) Change the reporting service report manager URL (port or virtual directory name) as in below steps

  • Step 1 : Type Reporting Service Configuration Manager in Run.
  • Step 2 : Go to Web Service URL and change TCP Port.
  • Step 3 : Go to Report Manager URL and go the Advance and Edit the Port Number.
  • Step 4 : Save it, and all is Done.