Skip to Content
author's profile photo Former Member
Former Member

Error in File - Unable to connect: incorrect log on parameters.

Hello, I am getting a problem when download report as Pdf file. It shows error named "Unable to connect: incorrect log on parameters." why i am getting this error, before report was downloading without any error.

Add a comment
10|10000 characters needed characters exceeded

Related questions

7 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 24, 2014 at 07:23 AM

    I have installed the whole redist package. But i need to include all required dll and I am not able to find refrence of those dll.

    I am getting this error when call the function to export as pdf.

    My requirement is that I export data after filtering according to date. In some date range pdf is exporting successfully without any error.

    But on some ranges of dates LogOn error occurs.

    Following code I am using:

    GenerateCrystalReport generatCR = new GenerateCrystalReport();

    CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument =

    new CrystalDecisions.CrystalReports.Engine.ReportDocument();

    CrystalDecisions.ReportAppServer.ReportDefModel.Section headersection;

    CrystalDecisions.ReportAppServer.ReportDefModel.Section columnsection;

    CrystalDecisions.ReportAppServer.ReportDefModel.Section rowsection;

    string name = ds_user.Tables[0].Rows[0]["name"].ToString();

    string age_sex = age + "/" + ds_user.Tables[0].Rows[0]["sex"].ToString();

    string email_address = ds_user.Tables[0].Rows[0]["email"].ToString();

    string contact = ds_user.Tables[0].Rows[0]["contactno"].ToString().Replace("+", "");

    string printdate = DateTime.UtcNow.ToString("dd MMM yyyy");

    string daterange = Convert.ToDateTime(tb_from).ToString("dd MMM yyyy") + " To " + Convert.ToDateTime(tb_to).ToString("dd MMM yyyy");

    reportDocument.Load(HttpContext.Current.Server.MapPath("~/bin/reports/List.rpt"));

    ISCDReportClientDocument reportClientDoc = reportDocument.ReportClientDocument;

    dataSetReportDetails.WriteXml(HttpContext.Current.Server.MapPath("~/bin/reports/MList.xml"), XmlWriteMode.WriteSchema);

    CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo connectionInfo = generatCR.getConnectionInfo(HttpContext.Current.Server.MapPath

    ("~/bin/reports/MList.xml"));

    reportDocument.Subreports[0].SetDataSource(dataSetReportDetails.Tables[0]);

    generatCR.SetParameters(reportDocument, name, age_sex, email_address, contact, printdate, daterange);

    downloadPDF(reportDocument, "Details_List" + daterange + ".pdf");

    //function to get connection info for created xml file from dataset

    public CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo getConnectionInfo(string xmlFilePath)

    {

    PropertyBag logonInfo = new PropertyBag();

    logonInfo.EnsureCapacity(1);

    logonInfo.Add("XML File Path", xmlFilePath);

    PropertyBag attributes = new PropertyBag();

    attributes.EnsureCapacity(5);

    attributes.Add("Database DLL", "crdb_adoplus.dll");

    attributes.Add("QE_DatabaseType", "ADO.NET (XML)");

    attributes.Add("QE_ServerDescription", "NewDataSet");

    attributes.Add("QE_SQLDB", true);

    attributes.Add("QE_LogonProperties", logonInfo);

    CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo connectionInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();

    connectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;

    connectionInfo.Attributes = attributes;

    return connectionInfo;

    }

    //set parameters value in report

    public void SetParameters(ReportDocument reportDocument, string name, string age_sex, string email_address, string contact, string printdate, string daterange)

    {

    reportDocument.SetParameterValue("pname", name);

    reportDocument.SetParameterValue("p_agesex", age_sex);

    reportDocument.SetParameterValue("email_id", (email_address != "" && email_address != null) ? email_address : "NA");

    reportDocument.SetParameterValue("pcontact", (contact != "" && contact != null) ? contact : "NA");

    reportDocument.SetParameterValue("printdate", printdate);

    reportDocument.SetParameterValue("daterange", daterange);

    reportDocument.SetParameterValue("next_page_head", name );

    reportDocument.SetParameterValue("headerlogoPath", (HttpContext.Current.Server.MapPath("~/images/") + "Report-logo.png").ToString());

    reportDocument.SetParameterValue("single", true);

    reportDocument.SetParameterValue("today_date", Convert.ToDateTime(printdate).ToString("dd/MM/yyyy"));

    reportDocument.SetParameterValue("today_date1", Convert.ToDateTime (printdate).ToString("dd/MM/yyyy"));

    reportDocument.SetParameterValue("picture_path", MyImgPath);

    reportDocument.SetParameterValue("picture_path1", MyImgPath);

    }

    //Export to pdf

    public void downloadPDF(ReportDocument reportDocument, string filename, bool mobile)

    {

    MemoryStream oStream = (MemoryStream)reportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

    reportDocument.Close();

    reportDocument.Dispose();

    HttpContext.Current.Response.ContentType = "application/pdf";

    HttpContext.Current.Response.AddHeader("Content-Length", oStream.Length.ToString());

    HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + filename);

    HttpContext.Current.Response.BinaryWrite(oStream.ToArray());

    HttpContext.Current.ApplicationInstance.CompleteRequest();

    HttpContext.Current.Response.End();

    reportDocument.Export();

    }

    I find the exception As LogOn Failed in following line-

    (MemoryStream)reportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 21, 2014 at 10:03 AM

    It is really difficult to answer the question when basic information is not available.

    Could you provide, version of CR, version of VS, win or web app, a snapshot of error and the sample code.

    - Bhushan

    Senior Engineer

    SAP Active Global Support

    Follow us on Twitter

    Got Enhancement ideas? Try the SAP Idea Place

    Getting started and moving ahead with Crystal Reports .NET applications.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 21, 2014 at 03:19 PM

    And there is a good possibility you are using some third party software or maybe even Business One version.

    Please clarify.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 22, 2014 at 04:53 AM

    Crystal Reports version is 13.0.2.469

    Visual Studio -2012.

    I am using Crystal Reports in web application which has 2 subreports and exporting as PDF file.


    on Local machine it is works fine if I fill dummy parameters in report preview and file path of report dataset file. But After deploying on server, all reports are working fine expect that one.

    At the time of export, it is giving following error message:

    Logon failed.Failed to export the report.

    Error in File testing {F282207C-64BC-43R3-8EB8-562E6FB9643E}.rpt:

    Unable to connect: incorrect log on parameters.

    Add a comment
    10|10000 characters needed characters exceeded

    • 13.0.2 is not supproted with VS 2012. You need atleast 13.0.5.

      I would suggest you to upgrade to SP 10. (13.0.10.)

      http://scn.sap.com/docs/DOC-7824

      Could you elaborate what exactly do you mean by

      if I fill dummy parameters in report preview and file path of report dataset file

      Does your application use datasets to pass the data to the report?

      The error is self explanatory. Logon failed. which means the report tried to connect to the DB or tried to fetch the data or didnt get the data from Dataset and it failed before the export.

      Could you make sure that you are passing the DB logon info to main report and subreport as well.

      Thanks,

      Bhushan

  • author's profile photo Former Member
    Former Member
    Posted on Jul 23, 2014 at 06:39 AM

    But I am using same version of CR with VS 2012 from last one year and It was working fine. Also all other reports in application are not showing any error of this type.

    I wonder this issue is user dependent, For some of our user report downloaded successfully and for some we are getting mentioned error.

    Yes I am using dataset to pass the data to report. (I have checked by debug code and found there is no issue in user's data).

    Actually this report was showing error on development server too. When I open main report preview, a screen displays where I have to pass dummy values to report parameters and it also ask for file path of data set (.xsd). After this report is exported on development server without any error. If I run this application on another system then it does not accept that file path because that was on local system drive to that system and shows 'logon failed' error.

    Would i have to pass DB logon info using code??

    Add a comment
    10|10000 characters needed characters exceeded

    • If the report is using datasets, you do not want to pass it any db logon code.

      It's really hard to help, if you can not / do not want to go to a supported environment. Note that as Bhushan recommended, updating to SP 10 is a trivial process and I'd highly recommend that you do this step.

      Also. Note that now you appear to have at least two issues; Load report failed, Log on failed. Who know what else. Please do update to SP 10, and if there are issues we can troubleshoot those. But at least we will be in a supported environment.

      - Ludek

      Senior Support Engineer AGS Product Support, Global Support Center Canada

      Follow us on Twitter

  • author's profile photo Former Member
    Former Member
    Posted on Aug 19, 2014 at 04:55 AM

    I have upgraded version of CR to SP 10. Now I need to include the required dll in references. I have searched in c drive(OS drive) and not able to find any of required dll.


    Please help me where I can find following :


    CrystalDecisions.CrystalReports.Design.dll

    CrystalDecisions.CrystalReports.Engine.dll

    CrystalDecisions.ReportSource.dll

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 25, 2014 at 03:57 AM

    I am selecting the same range of 30 days. But on some particular dates selection I am getting this problem.

    For eg:- If i select the range 1/04.2014-30/04/2014 then there is no problem but on selection some other date range like 1/08/2014-30/08/2014 'LogOn' error occurs.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.