Skip to Content
Former Member
Oct 30, 2009 at 10:16 AM

Problem with Synonyms


Hello, <br><br>

we are developing designing our reports on an Oracle database in a certain schema. To be able to run those reports at our customers we have written software which replaces our database schema by the one the customer uses besides other functionality. Often the tables used in the reports are at our customersu2019 databases synonyms on tables in yet another schema. <br>

Until we switch to the .NET SDK this was no problem. But if I now switch the table location to a synonym the report looses all internal information about the fields of the table. Thus all information about links to parameters and joins of tables are also gone.<br>

If I save the report after replacing the table locations and open the saved copy in the Crystal Designer, I can only see tables without any fields in the Database Expert.<br><br>

Iu2019m modifying the table location with code like in the following example:<br>


ReportDocument rdReport = new ReportDocument();<br>

rdReport.Load(sReportName, OpenReportMethod.OpenReportByTempCopy);<br>

CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rcDocument = rdReport.ReportClientDocument;<br>

for (int i = 0; i < rdReport.Database.Tables.Count; ++i)<br>


CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable rctTable = rcDocument.DataDefController.Database.Tables<i>;<br>

CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable rctNew = new CrystalDecisions.ReportAppServer.DataDefModel.Table();<br>

rctNew.Name = rctTable.Name;<br>

rctNew.Alias = rctTable.Alias;<br>

rctNew.QualifiedName = rctTable.QualifiedName.Replace("OLD_SCHEMA","NEW_SCHEMA");<br>

rctNew.ConnectionInfo = rctTable.ConnectionInfo.Clone(true);<br>

CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pbAttr = rctNew.ConnectionInfo.Attributes;<br>

pbAttr[sAttrDBDll] = "crdb_ado.dll";<br>

pbAttr[sAttrDBName] = sDBName;<br>

pbAttr[sAttrDBType] = "OLE DB (ADO)";<br>

pbAttr[sAttrServerDesc] = sServerName;<br>

pbAttr[sAttrSQLDB] = "True";<br>

pbAttr[sAttrSSO] = "False";<br>

CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pbLogOnProp = (CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag)pbAttr[sAttrLogOnProp];<br>


// set new connection string<br>


// set user/pwd<br>

rctNew.ConnectionInfo.UserName = sUserId;<br>

rctNew.ConnectionInfo.Password = sPwd;<br>

// apply changes<br>

rcDocument.DatabaseController.SetTableLocation(rctTable, rctNew);<br>




Does anybody know if there is a workaround so that I can modify the table location to a synonym without loosing the field information?<br><br>

Thanks in advance.