I would like to dump the raw data that is used to create a report to Excel.
My intent is to be able to dump the raw data that feeds a report, be it a top level report, or a drill - through report (a report called by another report). How can I retrieve the raw data that feeds the currently viewed report?
Telerik Reporting 2011 Q1 5.0.11.603
VS 2008 using WebForms
All reports datasources are SQLDatasource Stored Procedures with the report parameters fed from the application to the report object
The following is the method I am currently using for the top level report only.
Thank you in advance.
Patti
My intent is to be able to dump the raw data that feeds a report, be it a top level report, or a drill - through report (a report called by another report). How can I retrieve the raw data that feeds the currently viewed report?
Telerik Reporting 2011 Q1 5.0.11.603
VS 2008 using WebForms
All reports datasources are SQLDatasource Stored Procedures with the report parameters fed from the application to the report object
The following is the method I am currently using for the top level report only.
Protected
Sub
btnDumpToExcel_Click(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
btnDumpToExcel.Click
Dim
RunRpt
As
String
=
Me
.ReportViewer1.Report.Reports(0).Name
Dim
tb
As
New
DataTable(RunRpt)
Dim
dataConn
As
New
SqlConnection
Select
Case
RunRpt
Case
"evRptBehaviorChange"
Dim
report1
As
Snap_EvalReports.evRptBehaviorChange = ReportViewer1.Report.Reports(0)
With
report1
Dim
xSQLDatasource
As
Telerik.Reporting.SqlDataSource = .DataSource
Dim
SQLConnectionString
As
String
= System.Configuration.ConfigurationManager.ConnectionStrings(xSQLDatasource.ConnectionString).ToString
Dim
xSelectCommand
As
String
= xSQLDatasource.SelectCommand
dataConn.ConnectionString = SQLConnectionString
dataConn.Open()
Dim
sdc
As
SqlCommand =
New
SqlCommand(xSelectCommand, dataConn)
sdc.CommandTimeout = LengthOfTimeOut
sdc.CommandType = CommandType.StoredProcedure
'xSQLDatasource.SelectCommandType
For
Each
p
As
Telerik.Reporting.SqlDataSourceParameter
In
xSQLDatasource.Parameters
Dim
xParam
As
SqlParameter =
New
SqlParameter(p.Name, p.
GetType
)
sdc.Parameters.Add(xParam)
Next
' ALTER PROCEDURE [dbo].[StoredProcedure1]
'(
@FiscalYearID int=3
)
sdc.Parameters.Item(
"@FiscalYearID"
).Value =
CType
(Session(
"spaFiscalYear"
),
Integer
)
Dim
sda
As
SqlDataAdapter
sda =
New
SqlDataAdapter(sdc)
sda.Fill(tb)
dataConn.Close()
dataConn =
Nothing
XLSExport(tb, RunRpt)
End
With
End
Select
End
Sub
Thank you in advance.
Patti