Skip to Content
0

Crystal Reports do not take parameters from .Net application

Aug 11, 2017 at 08:42 AM

70

avatar image
Former Member

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?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Don Williams
Aug 11, 2017 at 02:49 PM
0

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

Show 1 Share
10 |10000 characters needed characters left 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

0
Don Williams
Aug 15, 2017 at 07:32 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded