Click here to Skip to main content
15,074,464 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
In my Project I am trying to open a Crystal report after writing the Dataset values to the XML file, but after loading the Report when I try to open it throws the Exception Database Logon Failed

I had tried with the following code,

C#
protected void getpkeys_Click(object sender, EventArgs e)
{
    try
    {

        ReportDocument rpt = new ReportDocument();
        DataSet ds = Namespace.SP.Storedprocedure_Select().GetDataSet();

        if (ds.Tables[0].Rows.Count > 0)
        {

                        ds.WriteXml(Server.MapPath("~/XMLReports/Passkeys.xml"));
            string filename = Server.MapPath("~/Path/Upload/Pkey_rpt.rpt");
            rpt.Load(filename);
            rpt.SetDataSource(ds);
            rpt.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "ExportedReport");

        }
    }
    catch (Exception ex)
    {
        ClientMessaging(ex.Message);
    }
}
Posted

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900