Skip to Content
avatar image
Former Member

Crystal Reports do not take parameters from .Net application

I'm working on a crystal report (ver.2016) reading an excel and generating the report from .Net (C#) application. It works fine in my local however gives error on server (win.2008 R2) - 'Login failed, incorrect logon parameters'. It does not accept the parameters passed from .Net app. Here is the .Net code

ConnectionInfo connectionInfo = newConnectionInfo();

connectionInfo.ServerName = this.MapPath(".") + "\\reports\\" + "Test\\Report1.xlsx";

connectionInfo.DatabaseName = this.MapPath(".") + "\\reports\\" + "Test\\Report1.xlsx";

connectionInfo.IntegratedSecurity = true;

rptDocument.Database.Tables[0].LogOnInfo.ConnectionInfo = connectionInfo;

rptDocument.SetParameterValue("@FY", lblFiscalYear.Text);

rptDocument.SetParameterValue("@Number", AccountCookie["AccountNumber"].ToString());

Stream oStream = rptDocument.ExportToStream(ExportFormatType.PortableDocFormat);

byte[] byteArray = newbyte[oStream.Length];

oStream.Read(byteArray, 0, Convert.ToInt32(oStream.Length - 1));

Can anyone please help me?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Aug 11, 2017 at 02:49 PM

    What SDK are you using.

    CR for VS si the SDK package for CR 2011 and above now.

    You can get it from here:

    https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

    Install the EXE into VS 2010 or above and the rest are for redist, don not install on DEV PC.

    Don

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for your reply Don. I've Installed CRforVS_13_0_20 from the same link in both local machine and on server. All my other crystal reports which reads from SQL Server tables work fine (taking parameters from C# code) in both local and server.

      Problem is with the report that reads from Excel, which works fine in my local but NOT on server.

      Thanks

  • Aug 15, 2017 at 07:32 PM

    Use Process Monitor to see what the difference is/missing and/or use CRLogger to see what Crystal is doing.

    Add comment
    10|10000 characters needed characters exceeded