hi everyone
im really new to report viewer in vb.net and i wanto import the data from an excel file to the reportviewer in vb.net can anyone help me out?
here is waht i tried so far:
Private Sub ViewReport_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
Me.ReportViewer1.RefreshReport()
End Sub
Private Sub ReportViewer1_Load(sender As System.Object, e As System.EventArgs) Handles ReportViewer1.Load
ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
conn = New OleDbConnection
conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + strExcelPath + ";Extended Properties=Excel 12.0;")
'dta = New OleDbDataAdapter("Select * From [Sheet1$]", conn)
conn.Open()
adpt = New OleDbDataAdapter("select * from [Sheet1$]", conn)
rs = New DataTable
adpt.Fill(rs)
Dim ds As DataSet = New DataSet("DataSetOne")
ds.Tables.Add(rs)
Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources.Add(New ReportDataSource(strExcelPath))
ReportViewer1.LocalReport.Refresh()
End Sub
the variable strExcelPath is a string variable that holds the location of the exel file i wan to import
any help will be greatly appriciated
thanks in advance