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:
  1. '*SQL* Using conn As New SqlConnection(DBconection)
  2.                 Using conn As New OleDbConnection(DBConection)
  3.                     '*SQL* Using command As New SqlCommand(sqlcommand, conn)
  4.                     Using command As New OleDbCommand("SELECT * FROM tbl_Members", conn)
  5.                         conn.Open()
  6.                         '*SQL* Using reader As SqlDataReader = command.ExecuteReader()
  7.                         Using reader As OleDbDataReader = command.ExecuteReader()
  8.  
  9.                             Dim table As New DataTable
  10.                             table.Load(reader)
  11.  
  12.                             Dim rds = New ReportDataSource("DataSetReport_Member_DataTableMember", table)
  13.  
  14.                             Me.rptViewer.LocalReport.DataSources.Clear()
  15.                             Me.rptViewer.LocalReport.ReportEmbeddedResource = "Test.rptMember.rdlc"
  16.                             Me.rptViewer.LocalReport.DataSources.Add(rds)
  17.                             Me.rptViewer.RefreshReport()
  18.  
  19.                         End Using
  20.                     End Using
  21.                 End Using


(testing with Access, and will be rolling over to SQL at a late date)


Cheers,