Print Page | Close Window

Change Location property of table object

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=1731
Printed Date: 07 May 2024 at 4:47am


Topic: Change Location property of table object
Posted By: zhiyuan
Subject: Change Location property of table object
Date Posted: 21 Nov 2007 at 7:31am
CryMy report uses COMMAND AS data sourse, and when I change the location of data source in my C# code, I have to assign the myTable.Location property, I found .net read in COMMAND as one table, so, when I assign its location as

MyTable.Location = (string)ConfigurationSettings.AppSettings["databaseName"] + ".dbo." + crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1);

after this statement, Location will be something like SERVERNAME.dbo.COMMAND, and CryI get following error message:
 
System.Runtime.InteropServices.COMException was caught
  Message="Failed to load database information.\nDetails: The database DLL 'crdb_query.dll' could not be loaded.\rError in File C:\\DOCUME~1\\Zhiyuan.Li\\LOCALS~1\\Temp\\serviceReport {935100AA-592A-4781-BBAC-9F61FF773FCE}.rpt:\nFailed to load database information."
  Source="rptcontrollers.dll"
  ErrorCode=-2147482931
 
however, if I just assign its location property to COMMAND, which is just as how it read in, I got following error message when doing the report export:
 
CrystalDecisions.CrystalReports.Engine.InternalException was caught
  Message="Failed to open a rowset.\nDetails: ADO Error Code: 0x\nSource: Microsoft OLE DB Provider for SQL Server\nDescription: Incorrect syntax near ','.\nSQL State: 42000\nNative Error: \rFailed to open a rowset.\rError in File C:\\DOCUME~1\\Zhiyuan.Li\\LOCALS~1\\Temp\\serviceReport {AAD0566D-162B-482F-8035-90B39BED5B9C}.rpt:\nFailed to open a rowset."
  Source="CrystalDecisions.ReportAppServer.DataSetConversion"
  StackTrace:
       at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)
       at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
       at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
       at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
       at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export()
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
       at ReportsForServiceProvider.ReportManager.SaveAsPDF(ReportDocument aReport, String spName) in C:\Documents and Settings\Zhiyuan.Li\My Documents\Visual Studio 2005\Projects\ReportsForServiceProvider\ReportsForServiceProvider\ReportManager.cs:line 242
 
Can anyone give me a hint on what I should do with Command when assigning Location property?
 
Thanks
 
Zhiyuan



Replies:
Posted By: jkwrpc
Date Posted: 21 Nov 2007 at 12:42pm
I am not certain what you are trying resolve. The CR command object generally holds the SQL query. I have never tried to iterate its return in the CR objects. I believe each command object returns essentially a single table of data. I am not aware of a single command object returning multiple tables.
 
If you are talking about a .Net command object that was not clear to me.
 
I am wondering if simply using a .Net dataset might not be a better solution and give you added flexibility.
 
I am sorry I code in VB.Net so I cant send anything in C#. Perhaps others on the forum can help in that regard. They may be able to correct any mistakes in my understanding of the CR Command object.
 
Regards,
 
John W.
http://www.CustomReportWriters.net - www.CustomReportWriters.net



Print Page | Close Window