populating a RDLC report

Submitted by JRCharlie on
Hi all I'm new to reports. I'm trying to populate the RDLC file with a DataTable I created Dynamically. I also read and tried your post ''Load RDLC Report Using Report Viewer Programmatically'' But I was unsucssesful. Here is my code can some one help. Thanks.
  1. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         mydt()
  3.         'DataSet1.MYDT.CopyToDataTable(dview)
  4.         Me.DataGridView1.DataSource = mydt()
  5.         With Me.ReportViewer1.LocalReport
  6.             .ReportPath = "Repot1" & ".rdlc"
  7.             .DataSources.Clear()
  8.         End With
  9.         Dim rptDataSource As ReportDataSource
  10.         rptDataSource = New ReportDataSource("Report_qry", mydt)
  11.         Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)
  12.     End Sub
  13.  
  14.     Private Function mydt() As DataTable
  15.         Dim mycon As New Connection
  16.         mycon.FilePath = "C:\CWDEsign\Cwdesign.txt"
  17.         mycon.connect()
  18.         Dim query As String = "Select * from Report_qry"
  19.         Dim cmd As New OleDb.OleDbCommand(query, mycon.con)
  20.         cmd.CommandType = CommandType.Text
  21.         cmd.CommandText = query
  22.         mycon.con.Open()
  23.  
  24.         Dim dataviews As DataView
  25.         Dim dt As New DataTable
  26.         Dim m_dr As OleDbDataReader
  27.         dt.DefaultView.AllowNew = False
  28.         m_dr = cmd.ExecuteReader
  29.         dt.Load(m_dr)
  30.         dataviews = New DataView(dt)
  31.         Dim dataset1 As New DataSet
  32.         dataset1.Tables.Add(dt)
  33.         Return dt
  34.     End Function