Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Table descriptions vanish when ADO dataset is converted

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

Former Member
Not what you were looking for? View more on this topic or Ask a question