Sql Connection and RegData

Stimulsoft Reports.NET discussion
Post Reply
Arvin Boggs
Posts: 9
Joined: Mon Sep 17, 2007 5:50 pm

Sql Connection and RegData

Post by Arvin Boggs »

During runtime, can I specify an ADO.Net DataTable as data source for a schema design with Sql Connection Data Source?
Currently, it does not seem to work.

In designer:
1. I created an Sql Connection
2. I created a new data source from the Sql Connection created in step 1.
3. Then, I dragged the data source on the page. This create a Data Band with all the columns from the table.

In code:

Code: Select all

Dim pReport As New Stimulsoft.Report.StiReport
pReport.Load("C:\myReport.mrt")
'myTable has the same schema (but different data) as the table source created in Step 2
pReport.RegData(myTable)
pReport.Render()
pReport.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, "C:\myPdf.pdf")
Problem:
myPdf still contains the data created in Step 2 instead of the data in myTable.
User avatar
Fabio Pagano
Posts: 355
Joined: Mon Apr 16, 2007 12:38 pm
Location: Bari (Italy)

Sql Connection and RegData

Post by Fabio Pagano »

First: i am a newbie, but try this, don't know if will work:

Code: Select all

Dim pReport As New Stimulsoft.Report.StiReport
pReport.Load("C:\myReport.mrt")
'---
pReport.Dictionary.DataSources.Clear()
'---
'myTable has the same schema (but different data) as the table source created in Step 2
pReport.RegData(myTable)
'---
pReport.Dictionary.Synchronize()
'---
pReport.Render()
pReport.ExportDocument(Stimulsoft.Report.StiExportFormat.Pdf, "C:\myPdf.pdf")
Arvin Boggs
Posts: 9
Joined: Mon Sep 17, 2007 5:50 pm

Sql Connection and RegData

Post by Arvin Boggs »

Thanx for the very prompt reply (less than 6 hours).
I will test your solution as soon as I get home. Then I will post the result. I hope it works.
Fabio wrote:First: i am a newbie, but try this, don't know if will work:
Sir, you very humble. I know you have been helping people here in the forum.
Arvin Boggs
Posts: 9
Joined: Mon Sep 17, 2007 5:50 pm

Sql Connection and RegData

Post by Arvin Boggs »

Thanx for your solution. It worked.
Post Reply