cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid argument for database Error when using ApplyLogonInfo (ADO.NET)

Former Member
0 Kudos

The machine that I am experiencing problems with:

Windows 2003 64 bit - Service Pack 2

What is your current report data source (e.g., ODBC, OLEDB,

Salesforce.com)?

ADO.Net (.NET DataSet Povider)

What is your current browser (e.g., IE SP2, Firefox 2.0)?

IE6, IE7

What Crystal Reports version and patch level do you have installed?

Crystal Reports XI Service Pack 4

I am getting the following error:

Error in File C:\WINDOWS\TEMP\ReportBilTest

{CB28F2B1-B693-46DA-BF0F-23115E5CF524}.rpt:

Invalid argument for database.

Stack Trace:

at

CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetExceptio

n(Exception e)

at CrystalDecisions.ReportSource.EromReportSourceBase.[1]p(Exception

k)

at

CrystalDecisions.ReportSource.EromReportSourceBase.GetLastPageNumber(Rep

ortPageRequestContext reqContext)

at

CrystalDecisions.CrystalReports.Engine.FormatEngine.GetLastPageNumber(Re

portPageRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine. ..ctor(FormatEngine

formatEngine, ExportRequestContext requestContext)

at

CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequest

Context reqContext)

at

CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptio

ns options)

at

Pivetal.Qspeeq.Web.Popups.SLA_Template_View.ExportReportToFile(String

SourceFile, String TargetFolder, String TargetFile, String Customer,

String Site) in

C:\Development\Bleddyn\QspeeqNoc\QspeeqNoc\Popups\SLA_Template_View.aspx

.cs:line 208

Here is a brief description of the issue I am experiencing:

We are using the following code: The error we are getting is above. The

Dll which is being referenced is connecting to cubes on a sql analysis

server. If we do not change the logon properties everything is fine, but

if we change the location of the dll, the query to the cube gets

executed returning a dataset as normal within the dll but and error

occurs as above (which seems to happen within crystal reports rather

than our DLL). What we have noticed is that when executing the following

command:

doc.Database.Tables[nDBTableIndex].ApplyLogOnInfo(doc.Database.Tables[nD

BTableIndex].LogOnInfo);

an extra value gets applied to the logonproperties

(doc.Database.Tables[nDBTableIndex].LogOnInfo.ConnectionInfo.LogonProper

ties) hashtable. The name of the new pairing "PreQEServerName" and do

not know where it is coming from! Again even if we do not change the

logonproperties at all this issue still occurrs when we execute

ApplyLogOnInfo.

Thanks in Advance and hopefully there is enough information!

Bleddyn Lawrence

CrystalDecisions.CrystalReports.Engine.ReportDocument doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

CrystalDecisions.Shared.HTMLFormatOptions htmlOpts = CrystalDecisions.Shared.ExportOptions.CreateHTMLFormatOptions();

CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = CrystalDecisions.Shared.ExportOptions.CreateDiskFileDestinationOptions();

CrystalDecisions.Shared.ExportOptions exportOpts = new CrystalDecisions.Shared.ExportOptions();

htmlOpts.HTMLBaseFolderName = TargetFolder;

// Set the HTML format options.

htmlOpts.HTMLFileName = TargetFile;

exportOpts.ExportFormatOptions = htmlOpts;

// With HTML the destination options need to be set also.

diskOpts.DiskFileName = TargetFile;

exportOpts.ExportDestinationOptions = diskOpts;

// Export the report.

exportOpts.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;

exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML40;

try

{

doc.Load(SourceFile);

#region Testing

/*

for (int nDBTableIndex = 0; nDBTableIndex < doc.Database.Tables.Count; nDBTableIndex++)

{

ConnectionInfo oConnInfo = doc.Database.Tables[nDBTableIndex].LogOnInfo.ConnectionInfo;

for (int nLPIndex = 0; nLPIndex < oConnInfo.LogonProperties.Count; nLPIndex++)

{

NameValuePair2 oLP = (NameValuePair2)oConnInfo.LogonProperties[nLPIndex];

if (oLP.Name.ToString() == "File Path ")

{

string sCubeProxyFile = @"C:\SomeFileLocation\CubeProxy.dll";

if (File.Exists(sCubeProxyFile))

{

oConnInfo.LogonProperties.Set(oLP.Name, sCubeProxyFile);

}

}

}

doc.Database.Tables[nDBTableIndex].ApplyLogOnInfo(doc.Database.Tables[nDBTableIndex].LogOnInfo);

doc.Database.Tables[nDBTableIndex].LogOnInfo.ConnectionInfo.LogonProperties.RemoveAt(doc.Database.Tables[nDBTableIndex].LogOnInfo.ConnectionInfo.LogonProperties.Count-1);

}

*/

#endregion Testing

}

catch (Exception oEx)

{

string s = oEx.Message;

}

foreach (CrystalDecisions.Shared.ParameterField p in doc.ParameterFields)

{

p.CurrentValues.Clear();

switch (p.Name)

{

case "Customer":

p.CurrentValues.AddValue(Customer);

break;

case "Company":

p.CurrentValues.AddValue(Customer);

break;

case "Time":

p.CurrentValues.AddValue(DateTime.Now.ToShortDateString());

break;

case "Date":

p.CurrentValues.AddValue(DateTime.Now.ToShortDateString());

break;

case "Metrics":

p.CurrentValues.AddValue("CountVoiceCalls,CountVideoCalls,CountIMs");

break;

case "CustomerName":

p.CurrentValues.AddValue(Customer);

break;

case "SiteName":

p.CurrentValues.AddValue(Site);

break;

case "DateString":

p.CurrentValues.AddValue(DateTime.Now.ToShortDateString());

break;

}

}

//doc.ExportToDisk( ExportFormatType , TargetFile);

try

{

doc.Export(exportOpts);

doc.Close();

}

catch (Exception ex)

{

System.Diagnostics.Debug.WriteLine("error exporting report: " + ex.ToString());

}

Accepted Solutions (1)

Accepted Solutions (1)

former_member200290
Contributor
0 Kudos

Hi,

Crystal Reports XI does not have 64 bit OS and chipset support. What you are doing could just simply not work. However there are a few trouble shooting steps you can try:

1: Test this on a 32 bit OS. If it works here then it points to it being a 64 bit compatibility issue.

2: Install Crystal Reports designer on this machine and try setting location with it. If this works then it points to a code issue. What you could do is look at the connection properties of the before and after of setting location and see if it differs from what you are setting at runtime. If this does not work it agains points to a 64 bit issue.

The first version of Crystal to support 64 bit Windows is Crystal Reports XI R2 SP3. You can try downloading the install and then updating to SP3 and see if it helps:

https://smpdl.sap-ag.de/~sapidp/012002523100006008462008E/crxir2.zip

Trevor.

Former Member
0 Kudos

Thanks for your response!

I have installed service pack 4 and everything works; by the way to get crystal reports working in iis run the following script which allows 32bit dlls to run on a 64 bit server (sorry if you know that already):

cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1

%SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe u2013i

The code I have presented does actually work if I do not change the location of the ADO.NET DLL. I.e. if i create a report using a dll from a specific location then when i come to running the report in my web application if I use the same DLL from the same location everything behaves as expected. It is only when i try to change the location of the DLL at runtime that there is a problem. If I do not use the code below (in effect hard coding the location of the DLL) there is no problem. This is not really acceptable as the location of the DLL should be configurable.

What we have noticed is that when executing the following

command:

doc.Database.Tables[nDBTableIndex].ApplyLogOnInfo(doc.Database.Tables[nDBTableIndex].LogOnInfo);

an extra value gets applied/added to the logonproperties

(doc.Database.Tables[nDBTableIndex].LogOnInfo.ConnectionInfo.LogonProper

ties) hashtable as stated above.

Thanks

Bleddyn

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for the advice but I have already tried to build the application targeting 32bit architecture, but this has not resolved my problem. Installing service pack 4 (the one after the link you sent me) resolved the issue which was concerning the link you suggested. My issue is trying to change the location of the ADO.net dll at runtime; these might be linked to the 64bit problem. But I am running the crystal reports dll as 32 bit hence why i had to enable 32bit applications to run on 64 bit server.

Thanks

Bleddyn

former_member184995
Active Contributor
0 Kudos

Make sure you build the application as 32 bit only.

You can do this by following the instructions in the following link:

[https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233303330333933303337%7D.do]

Jason

Edit: Oops, you updated while I was updating as well.

Edited by: Jason Everly on Jul 17, 2008 12:06 PM