cancel
Showing results for 
Search instead for 
Did you mean: 

Table descriptions vanish when ADO dataset is converted

Former Member
0 Kudos

Hi there,

with this coding I am able to read an ADO dataset and add the included tables (together with their fields) to the report. Unfortunately, if the tables in the ADO dataset had descriptions (added as alias), these texts are gone once I have converted the tables of the ADO dataset to the ISCRTables of Crystal.

What should I do to restore the descriptions?


System.Data.DataSet reportDataSet = new System.Data.DataSet();
                reportDataSet.ReadXml(tmpFile, XmlReadMode.ReadSchema);

                PropertyBag logonInfo = new PropertyBag();
                logonInfo.EnsureCapacity(1);
                logonInfo.Add("XML File Path", tmpFile);

                PropertyBag attributes = new PropertyBag();
                attributes.EnsureCapacity(5);

                attributes.Add("Database DLL", "crdb_adoplus.dll");
                attributes.Add("QE_DatabaseType", "ADO.NET (XML)");
                attributes.Add("QE_ServerDescription", "NewDataSet");
                attributes.Add("QE_SQLDB", true);
                attributes.Add("QE_LogonProperties", logonInfo);

                CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo connectionInfo = 
                    new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
                connectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
                connectionInfo.Attributes = attributes;

                //clear existing database tables in field explorer
                foreach (ISCRTable table in rasDoc.Database.Tables)
                {
                    rasDoc.DatabaseController.RemoveTable(table.Name);
                }

                ISCRTables datasetTables = DataSetConverter.Convert(reportDataSet).Tables;

                // Convert 'my table' to a crystal report table.
                List<aliasEntry> aliasList = m_report.getTableAliasList();
                foreach (aliasEntry m_aliasEntry in aliasList)
                {
                    ISCRTable datasetTable = datasetTables.FindTableByAlias(m_aliasEntry.getEntryID());
                    datasetTable.ConnectionInfo = connectionInfo;
                    rasDoc.DatabaseController.AddTable(datasetTable, null);
                }

Thanks & best regards,

Pascal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello, Pascal;

With BusinessObjects Crystal Reports the RAS attribute properties for the PropertyBag are different with different database drivers.

ADO.NET(XML) does not have the attributes you are trying to set. It is limited to the properties used by that driver.

See the Attributes property in the Developers Library [here|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/RAS_SDK/rassdk_com_doc/doc/rassdk_com_doc/Crystal_Reports_Data_Definition_Model_Library50.html].

Attributes As PropertyBag

Database Type Type of connection. (S)

File Path Full path to customer data provider DLL. (S, L)

Use Classes from Project Set to true to use classes from project. If true, next property is enabled. (L)

Class Name Name of class used to connect to data source. (S, L)

There is a sample that creataes a new report in the Developer Library. It uses the ODBC properties but will show you how they are used.

[Click|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/RAS_SDK/rassdk_com_doc/doc/rassdk_com_doc/StartHere_RASCOM4.html]

Find CSharp samples [here|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/RAS_SDK/rassdk__samples_aspx/data/rassdk_aspx_howto_CS_sample_115_en.zip] and [here|http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/en/RAS_SDK/rassdk__samples_aspx/data/rassdk_net_CS_feature_examples_115_en.zip].

In Crystal Reports an 'Alias' table is a copy of another table in the report added a second time for specific linking purposes since there is no option to loop through fields in a table in the design of the report.

Table A is added again as Table A1 so a join can be created between them.

I hope that will give you the information you need.

Elaine

Answers (0)