This is a migrated thread and some comments may be shown as answers.

Custom Data Set for Report

0 Answers 22 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shane Clay
Top achievements
Rank 1
Shane Clay asked on 18 Aug 2010, 02:04 PM
Hi There,

I am playing around with the reporting controls for the first time and have a question about the right way to do something. Essentially, I cannot use a normal data source for my report. There is a significant amount of custom work that needs to be done on what is in SQL Server to produce the data needed for the report. This info needs to be combined with parameters entered by the user at the time the report is run.

I assume Object Data Sources are the way to go.

I have created a data set (the .xsd type) and created a data table that mirror the data I plan to feed into the report. I've then used that dataset to build my report design.

Then, to populate the data, I have done the following;

 

 

Dim x As New DataTable

 

 

 

Dim dr As DataRow

 

x.Columns.Add(

 

"Col1")

 

x.Columns.Add(

 

"Col2")

 

dr = x.NewRow

dr(

 

"Col1") = "test1"

 

dr(

 

"Col2") = "test2"

 

x.Rows.Add(dr)

 

 


Dim
g As New Report6

 

g.ObjectDataSource1.DataSource = x

ReportViewer11.Report = g

I have never really used data sets and tables before, generally everything is done using sql querys odbcdatareaders connected to grids and so forth.

Is this the best way forward, or am I missing something more basic or straight forward?

Shane

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Shane Clay
Top achievements
Rank 1
Share this question
or