|
-
Jun 17th, 2009, 12:15 AM
#1
Dynamic Report Loading
Hi Guys,
Could some one please cast an expert eye over my attempt to dynamically load selected reports at run-time (only one example shown).
I have pre made various "DataSet_DataTable's" to accomodate the report structure, and created various associated reports.
The "DataSet_DataTable's" are NOT bound to any database - this happens in run time (at least that what appears to be happening, as it should)
All works. However, is there anything that I shouldn't be doing with the example below?
vb Code:
'*SQL* Using conn As New SqlConnection(DBconection)
Using conn As New OleDbConnection(DBConection)
'*SQL* Using command As New SqlCommand(sqlcommand, conn)
Using command As New OleDbCommand("SELECT * FROM tbl_Members", conn)
conn.Open()
'*SQL* Using reader As SqlDataReader = command.ExecuteReader()
Using reader As OleDbDataReader = command.ExecuteReader()
Dim table As New DataTable
table.Load(reader)
Dim rds = New ReportDataSource("DataSetReport_Member_DataTableMember", table)
Me.rptViewer.LocalReport.DataSources.Clear()
Me.rptViewer.LocalReport.ReportEmbeddedResource = "Test.rptMember.rdlc"
Me.rptViewer.LocalReport.DataSources.Add(rds)
Me.rptViewer.RefreshReport()
End Using
End Using
End Using
(testing with Access, and will be rolling over to SQL at a late date)
Cheers,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|