Query mandatory?

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v5)  /  Query mandatory?

DynamicPDF CoreSuite for .NET (v5) Forum

 Sep 04 2008 5:37 AM
When trying a very basic report, I'm getting exceptions thrown when the reports is missing a connection string and at least one query. I can't seem to find any way to run the report without this. Is this really the case, that a valid connection string and at least one query is mandatory? I'm planning to run a report without queries and use other means of populating the report.
 Sep 04 2008 6:24 AM
Posted by a ceTe Software moderator
Hello,

Yes, you can use the data from a DataTable in the report without using the query in the designer. You will have to use the Event Driven queries for this. You will have to specify a connection string in the designer, without a connection string it will throw an error. You can change the connection string programmatically or if you have an existing data then no need of using this connection string or query. You can refer to the Event Driven queries topic on our help documentation.

Thanks,
ceTe Software Support Team.
 Sep 04 2008 6:31 AM
A slight misunderstanding here, I think.
I don't want to use queries at all, in either way. I just want to design a layout in the designer and then do my own populating.
 Sep 04 2008 7:27 AM
Posted by a ceTe Software moderator
Hello,

You will have to provide a connection string when using the Report Writer product. This is designed to generate the reports using the data from a database or you can also use a DataTable object as data source. But you will have to specify the connection string in the designer.

If you have a DataTable then you can assign it to the record set of the report without using the connection string you have provided in the designer. There is no need of queries here. You will have to do this by using the event driven queries.

If you do not want to provide the connection string also then you will have to use the Generator product. There is no designer in this but you can create the PDF report without any problem. You will have a better control over all the elements. You can add the data to the PDF by using the page elements and you will have to specify the X, Y position for the elements.

Thanks,
ceTe Software Support Team.
 Aug 11 2013 6:42 PM
The workaround is to create the report query as a dummy Event query. You have to give it an ID (say, "Dummy") but not a connect string. Then in your code, do this to keep it happy:

DocumentLayout rpt = new DocumentLayout({path to dblx file});
Query Dummy = rpt.GetQueryById("Dummy");
Dummy.OpeningRecordSet += Dummy_OpeningRecordSet;

private void Dummy_OpeningRecordSet(object sender, OpeningRecordSetEventArgs e)
{
    e.RecordSet = new DataTableRecordSet(new DataTable());
}

If you're just using fields that you populate from code, I'd suggest that you only use Labels and do everything in the Header (give the detail section a height of zero)

All times are US Eastern Standard time. The time now is 10:22 AM.