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.
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- mydt()
- 'DataSet1.MYDT.CopyToDataTable(dview)
- Me.DataGridView1.DataSource = mydt()
- With Me.ReportViewer1.LocalReport
- .ReportPath = "Repot1" & ".rdlc"
- .DataSources.Clear()
- End With
- Dim rptDataSource As ReportDataSource
- rptDataSource = New ReportDataSource("Report_qry", mydt)
- Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)
- End Sub
- Private Function mydt() As DataTable
- Dim mycon As New Connection
- mycon.FilePath = "C:\CWDEsign\Cwdesign.txt"
- mycon.connect()
- Dim query As String = "Select * from Report_qry"
- Dim cmd As New OleDb.OleDbCommand(query, mycon.con)
- cmd.CommandType = CommandType.Text
- cmd.CommandText = query
- mycon.con.Open()
- Dim dataviews As DataView
- Dim dt As New DataTable
- Dim m_dr As OleDbDataReader
- dt.DefaultView.AllowNew = False
- m_dr = cmd.ExecuteReader
- dt.Load(m_dr)
- dataviews = New DataView(dt)
- Dim dataset1 As New DataSet
- dataset1.Tables.Add(dt)
- Return dt
- End Function
- 9 views