Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3132

CR runtime uses tables from the wrong schema (Oracle)

$
0
0

Hello:

 

I am in process of re-writing an old Delphi app that ran CR reports via the VCL component to a .Net app that uses the .Net CR components.

 

As for versions, I am using VS 2013, .Net 4.5.1 and I installed CRforVS_13_0_14. The reports connect to an Oracle 10g database. The reports that I am testing haven't been created by me. Some of them are very old.

 

I am experiencing a weird behavior in the .Net version where the CR runtime uses tables from the wrong schemas while the designer (11.0.0.895) works fine.

 

At runtime I am using the following code to set the connection information:

 

private ConnectionInfo CreateConnectionInfo()
{
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.UserID = _reportRequestInfo.ReportRunUser;
connectionInfo.Password = _reportRequestInfo.ReportRunPassword;
connectionInfo.ServerName = _reportRequestInfo.ReportRunInstance;
return connectionInfo;
}

 

private static void SetDbLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
{
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);

 

}
}

 

So, the report accesses a bunch of tables all in the same schema, let's say SCHEMA1. In design mode all works fine. However, at runtime, somehow CR assigns a different schema (or schemas) to some of the tables. The problem is that there is another schema in the database - let's call it SCHEMA2 -  that contains some tables with the same names as in SCHEMA1. I used a session browser to see the open cursors that the CR runtime runs and I can see that it runs queries such as this one:

 

  SELECT owner, object_type

    FROM sys.all_objects

   WHERE OBJECT_NAME = 'TABLE1'

ORDER BY object_type ASC

 

In some cases this returns more than one row, and unfortunately the first row is for the wrong schema, i.e. SCHEMA2.

 

What can I do to fix this? I have to admit, I am freaking out a bit. So far, I tested about 100+ reports, they all seemed fine, until today, when I compared the results for one report and the rows returned by the different versions of CR didn't match. I looked then at the queries both runtimes executed, the old version was fine, but the new one had used the wrong schemas for some of the tables.

 

Thanks


Viewing all articles
Browse latest Browse all 3132


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>