Skip to Content
0
Former Member
Jul 17, 2008 at 03:20 PM

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

143 Views

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

}