In this we are going to create a database connection using server user name and password. For this do the all the steps as previous post until
Make New Connection to Create a New DB connection,
in there give server name, username and password. If everything is correct you can select the server database in your list.
Now not like the previous, we want to give server credentials when we Load the report. Thus following codes you can use to give credentials in report.aspx
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument CollReport = new ReportDocument();
string reportPath = Server.MapPath("Report1.rpt");
CollReport.Load(reportPath);
CollReport.SetDatabaseLogon("username", "password", "servername", "db");
CrystalReportViewer1.ReportSource = CollReport;
}
Comments