Showing results for 
Search instead for 
Did you mean: 

build a report via c# application

Former Member
0 Kudos

Reports are created by our application (InProc RAS)

Our problem:

We have an ADO.NET Dataset which is created and filled at runtime.

The number of tables and fields change at runtime.

The ADO Dataset is never connected to a physically database. The dataset is filled by our application directly. How do I add this dataset to the report?

With RDC (Crystal Reports XI) we just created an ado dataset(adoRS) and passed it to the report by

CRAXDRT_TLB.Ireport(CRReport).Database.Tables.Add('', blank,

adoRS, blank, 'crdb_ado.dll' blank, blank, blank, blank,


Now with Crystal Reports 13.x we try like in KB #1300982 described. It works but only with physically or ODBC databases. Not with our’ in memory dataset’.

I do not know which properties have to be passed to  Table.ConnectionInfo for ADO.NET Dataset.

Which properties do I need for "QE_DatabaseType” and   "QE_LogonProperties”?


Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

My solution - till now:

-Create and fill a dataset.

-Call dataSet.WriteXml()

-Add the tables from xml


    private void AddTables(List<string> tables)


            RAS_ddm::Table boTable;

            boTable = new RAS_ddm::Table();

            m_boReportDocument = new RepEng::ReportDocument();

            m_boAttributes = new RAS_ddm::PropertyBag();

            m_boLogonInfo = new RAS_ddm::PropertyBag();

            m_boConnectionInfo = new RAS_ddm::ConnectionInfo();

            m_boTable = new RAS_ddm::Table();

            m_boReportClientDocument = m_boReportDocument.ReportClientDocument;


            m_boLogonInfo["File Path "] = @"D:\MaikS\projecte\DOT_NET\Experimente\AddTableTest2\AddTableTest2\my.xml";

            m_boAttributes["Database DLL"] = "crdb_adoplus.dll";

            m_boAttributes["QE_DatabaseName"] = "";

            m_boAttributes["QE_DatabaseType"] = "ADO.NET (XML)";

            m_boAttributes["QE_LogonProperties"] = m_boLogonInfo;

            m_boAttributes["QE_ServerDescription"] = "Blablub";

            m_boAttributes["QE_SQLDB"] = false;

            m_boAttributes["SSO Enabled"] = false;

            m_boConnectionInfo.Attributes = m_boAttributes;

            m_boConnectionInfo.UserName = "";

            m_boConnectionInfo.Password = "";

            m_boConnectionInfo.Kind = RAS_ddm::CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;

           foreach (string tab in tables)


                boTable.ConnectionInfo = m_boConnectionInfo;

                boTable.Name = tab;

                boTable.Alias = tab;

                boReportClientDocument.DatabaseController.AddTable(boTable, null);




-at least set dataset as datasource: m_boReportDocument.SetDataSource(dataSet);

the xml seems to be needed at design time only


Answers (1)

Answers (1)

Active Contributor
0 Kudos
Former Member
0 Kudos

Hello Ludek

I saw these resources. But they only describe how to connect data sources at runtime.

They do add tables with Crystal Designer. I have to add the tables at runtime by our application (because our reports are created at runtime)

Thanks Maik

Active Contributor
0 Kudos

OK, to add tables, you need to use the Report Creation APIs in the InProc RAS SDK. I have never tried to create / add tables to a report from an ADO .NET Dataset - not sure if that will be possible. The following doc has links to sample apps that show how to add tables and fields - from an actual database...:

You may have to think about creating a temporary table from your dataset and then adding the table / field to the report from that. A dataset DLL ( seee: Using The .NET DataSet Provider in Crystal Ente... | SCN ) may also be an option, but I really am blowing a lot of hot air here, never having done this my self.

Perhaps the better questions would be, why a dataset? Datasets may not buy you anything in terms or performance - particularly if these are multi-table datasets. Additionally, as MS does not allow direct access to the dataset, so the CR engine must create a copy for it's self (think performance...) And datasets do consume a lot of memory. We do not recommend more than a few thousand rows (like <5000) of data. After that, performance just starts to really decline to the point where going against an actual database is the way to go.

- Ludek

Former Member
0 Kudos

Sorry I was wrong with CR XIR2 we used an ADO Recordset not a Dataset.

Now I have to find a solution which works with Crystal Reports 20xx

As you mention, the samples use actual databases. That’s what I already tested successfully.

Your suggestion of using a Dataset Provider DLL sounds interesting. I will have a look at that. But as I remember the structure of  the table is static (compiled in)

Why we did use ADO Recordset?

Our reports are filled with calculated data. Each report consists of several tables. These tables have usually only few rows. During report production a report is opened a thousand times with different calculated input. It is possible that several instances of the same report are open at the same time. In this scenario it seems to be difficult using temp tables.

How about the performance, if we use an xml file? Does CR create a copy of these tables too?
But with xml we will have similar problems as with temp tables

Our customers have the possibility to modify our reports or create their own. They use formulas which define the tables and the fields in a table.

You can imagine the tables as objects or list of objects which are created by formulas. The fields are the properties of the object. Thus the data structure of tables and fields the users use to design a report is very flexible and cannot be determined at compile time. 


Former Member
0 Kudos

the following seems to be interesting:

sap note 1337030 - How to create a .NET provider assembly for the ADO.NET (XML) driver?

It explains how to create a generic .NET provider assembly.

But one problem resists. Is there any possibility to pass a context to the dll?

Else I would need one provider dll for each report with different data structure