0
votes

I am making a reporting website using crystal report,using a button to view the report. The first page of the report is displayed without a problem but when I click the navigation buttons to move to the next page of the report, I either get an error

"Logon failed. Details: ADO Error Code: 0x Source: Microsoft SQL Native Client Description: Login failed for user 'sa'. SQL State: 28000 Native Error: Error in File C:\DOCUME~1\SOFTLITE\ASPNET\LOCALS~1\Temp\ClientReport {02A69EDD-9B03-4490-B3A2-5E5E5F5592D9}.rpt: Unable to connect: incorrect log on parameters."

or Crystal Reports shows an input box to log on in database. My code is:

 protected void Button1_Click(object sender, EventArgs e)
{
            ReportDocument Summaryrpt = new ReportDocument();
            Summaryrpt.Load(Server.MapPath("BookSummary.rpt"));
            Summaryrpt.SetDatabaseLogon("sa", "nirvana", "Compro4", "lottery");
            CrystalReportViewer1.ReportSource = Summaryrpt;
}

please help me........

1
Any subreports or other datasources that are not hit until the next page?Maarten
I have no sub report or these kind of stuff.The error message displays when i use navigation button.Stash_Man

1 Answers

1
votes

I found the solution

 protected void Button1_Click(object sender, EventArgs e)
 {
        ReportDocument Summaryrpt = new ReportDocument();
        Summaryrpt.Load(Server.MapPath("BookSummary.rpt"));
        CrystalReportViewer1.ReportSource = Summaryrpt;
        var connectionInfo = new ConnectionInfo();
        connectionInfo.ServerName = "ComproLottery.db.6456862.hostedresource.com";
        connectionInfo.DatabaseName = "ComproLottery";
        connectionInfo.Password = "Br0@dW@ys68";
        connectionInfo.UserID = "ComproLottery";
        connectionInfo.Type = ConnectionInfoType.SQL;
        for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++)
        {
            CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo;
        }
  }