Click here to Skip to main content
15,917,940 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to make a report using this code. But the report shows no data, only blank white form. What is wrong with this code ? please help me
Private Sub rpPaket_Load(ByVal sender As System.Object, ByVal         e       As System.EventArgs) Handles MyBase.Load

    objConnection = New OleDbConnection(strConnectionString)
    objCommand = New OleDbCommand("SELECT * from TbPaket", objConnection)
    ReportViewer1.LocalReport.Refresh()

    'Initialize the DataAdapter object and set the SelectCommand property
    objDataAdapter = New OleDbDataAdapter
    objDataAdapter.SelectCommand = objCommand

    'Initialize the DataTable object
    objDataTable = New DataTable
    Dim DataSet1 As Database2DataSet8.TbPaketDataTable = New   Database2DataSet8.TbPaketDataTable
    'Populate the DataTable
    objDataAdapter.Fill(DataSet1)


    Dim ReportDataSource As New ReportDataSource("DataSet1_WORKORDERDataTable", CType(DataSet1, DataTable))
    ReportViewer1.LocalReport.DataSources.Clear()
    ReportViewer1.LocalReport.DataSources.Add(ReportDataSource)


End Sub
Posted

1 solution

try Use
VB
ReportViewer1.RefreshReport()

Like my code..
VB
ReportViewer1.LocalReport.DataSources.Clear()

   Dim adaptar As New HotelsDataSetTableAdapters.Rstrnt_Bill_TABLETableAdapter
   Dim rstrnt_Table As New HotelsDataSet.Rstrnt_Bill_TABLEDataTable
   adaptar.Fill1(rstrnt_Table, vOrder_ID)

   ReportViewer1.LocalReport.DataSources.Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", rstrnt_Table.DefaultView))
   ReportViewer1.LocalReport.ReportPath = "Reports\Rstrnt_Bill.rdlc"
   ReportViewer1.RefreshReport()
 
Share this answer
 
Comments
tiwi 30-Jan-15 3:31am    
thanks for your reply,

where do i need to make folder "Reports\Report3.rdlc" ? in the bin folder inside the project folder ?
/\jmot 30-Jan-15 4:16am    
no, it's the path of the report.
where is your report path??
/\jmot 30-Jan-15 4:16am    
1st try to use.
ReportViewer1.RefreshReport()
at the end of the code.
tiwi 30-Jan-15 5:38am    
I have put the path, it show error "an error occured during local report processing the report definition for report c:\user\tjiwi\document\visualstudio2005\project\report5.alec"
tiwi 30-Jan-15 5:39am    
It show error above when i run the program

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900