Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my code

With Me.ReportViewer1.LocalReport

                ' Report path
                .ReportPath = Application.StartupPath & "\..\..\Report1.rdlc"
                .DataSources.Clear(
            End With

            ' ----------------------------------------------------
            ' Datasource for the main report (where price > 200)
            ' ----------------------------------------------------
            Dim SQL As String = "SELECT Voter.SrNo, Voter.YadiNo, Voter.FullName, Voter.Gender, Voter.Age, Voter.HouseNo, Voter.Address, Voter.CardNo FROM Voter WHERE yadino=1"
            Using da As New OleDbDataAdapter(SQL, My.Settings.trialConnectionString)
                da.SelectCommand.Parameters.Add("@yadino", OleDbType.Integer).Value = 200

                Using ds As New DataSet
                    da.Fill(ds, "voter")

                    ' You must use the same name as defined in the report 
                    ' Data Source Definition
                    Dim rptDataSource As New ReportDataSource("dsReport_products", ds.Tables("voter"))
                    Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)

                End Using

            End Using

           
            ReportViewer1.RefreshReport()


i am getting the error when run
a data source instance has not been supplied for the data source trailDataset_voter

thanks in advance.
Posted
Comments
[no name] 23-Sep-13 3:33am    
I hope you binded the proper report file with the report viewer.
and apart from that
try using this after the fill method:
Me.ReportViewer1.Reset()
basurajkumbhar 23-Sep-13 3:42am    
its working but i am gettign the new error

the source of the report definition is not specified
[no name] 23-Sep-13 3:54am    
Have you tried the solution which i gave..??if yes and you are getting error then tell.if no then try..don't do unnecessary re-posts.
basurajkumbhar 23-Sep-13 3:59am    
yes i tried your posted code in my code after then it gives me this error


after implemented your code.
<pre>
Me.ReportViewer1.Reset()
With Me.ReportViewer1.LocalReport

' Report path
.ReportPath = Application.StartupPath & "C:\Users\noble\Desktop\WindowsApplication2\WindowsApplication2\Report1.rdlc"
'ReportViewer1.LocalReport.ReportPath = "C:\Users\noble\Desktop\WindowsApplication2\WindowsApplication2\Report1.rdlc"
.DataSources.Clear()
End With

' ----------------------------------------------------
' Datasource for the main report (where price > 200)
' ----------------------------------------------------
Dim SQL As String = "SELECT Voter.SrNo, Voter.YadiNo, Voter.FullName, Voter.Gender, Voter.Age, Voter.HouseNo, Voter.Address, Voter.CardNo FROM Voter WHERE yadino=1"
Using da As New OleDbDataAdapter(SQL, My.Settings.trialConnectionString)
da.SelectCommand.Parameters.Add("@yadino", OleDbType.Integer).Value = 200

Using ds As New DataSet
da.Fill(ds, "voter")

' You must use the same name as defined in the report
' Data Source Definition
Dim rptDataSource As New ReportDataSource("dsReport_products", ds.Tables("voter"))
Me.ReportViewer1.LocalReport.DataSources.Add(rptDataSource)

End Using

End Using


ReportViewer1.RefreshReport()
</pre>
[no name] 23-Sep-13 4:01am    
Please see how i mentioned..i didn't told like this..i told you to put the reset(), after that i told to use the format like this..

1 solution

VB
Me.ReportViewer3.Reset()

     Me.ReportViewer3.LocalReport.ReportPath = "";
     Dim rds As New ReportDataSource("", ds1.Tables(""))
     Me.ReportViewer3.LocalReport.DataSources.Add(rds)

mention the report path just after reset().as you wrote it outside so it's unable to identify the path...
Hope it will work..
 
Share this answer
 

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

  Print Answers RSS


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