cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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);

0 Kudos

If you set the same export range in CR Designer what happens?

Could be you are selecting an invalid date or date range. IT would throw an error in the Database because the range is not valid.

Don

Answers (6)

Answers (6)

Former Member
0 Kudos

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.

former_member183750
Active Contributor
0 Kudos

See if enabling the options shown below will help:

- Ludek

Former Member
0 Kudos

I checked report after enabling these options, but still getting error.

Thanks.

Uvika

former_member183750
Active Contributor
0 Kudos

My suggestion now would be to create a phone incident here:

Crystal Single Case Technical Support - SAP Business Objects US Online Store | SAP Online Store

I feel there is still information we are missing and that this will need to be discussed over the phone.

- Ludek

Former Member
0 Kudos

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

0 Kudos

All of the redist packages are here:

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

You can not manually include just those files, needs the whole redist package.

Don

Former Member
0 Kudos

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??

former_member183750
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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.

former_member188030
Active Contributor
0 Kudos

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

0 Kudos

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

Please clarify.

former_member188030
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi Bhushan

I am facing issue from last 10 days , please help me out.

Former Member
0 Kudos

Hi Bhushan

This is windows application using Visual studio 2010 & SAP crystal reports version 13,0.0.99

.

Please do the needful.

Regards


Eshwar

former_member183750
Active Contributor
0 Kudos

Please create a new post - after you have updated your install to SP 12. See for download links and make sure you use the install exe on your dev computer.

If that does not help, provide the following info in the new thread:

Database used

Connection type used

Win or web app

OS

Code used

Does the report work in dev and fails when app is distributed, or does it fail in both environments?

Does the report work in the CR designer?

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter