ReportViewer "A data source instance has not been supplied for the data " problem

B

Burak Gunay

Hello,

I have the following files in my project in Trap namespace

CourseCost.vb -> basic course cost class
DataSource.vb -> object data source class

I have a report on my default.aspx page as follows:

<rsweb:ReportViewer ID="ReportViewer1" runat="server"
Font-Names="Verdana" Font-Size="8pt"
Height="400px" Width="400px">
<LocalReport ReportPath="Report2.rdlc"
ReportEmbeddedResource="Report_Test.Report2.rdlc">
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="propcoursecost"
TypeName="Trap.DataSource2">
</asp:ObjectDataSource>

Here is the definition of propcoursecost

Public ReadOnly Property propcoursecost() As CourseCost
Get
'get new course cost information based on the change in
student number
Dim courseCost As New CourseCost

' assign new course cost information to course cost
object
With courseCost
.crsid = "CRS123"
.Students = 15
.StdntCostInd = 142
.StdntCostOpt = 156
.Instructors = 2
.InstructorCost = 70
.AnnualCost = 90
.TravelCost = 457
.TotalCost = 2345
End With

' return course cost information
Return courseCost
End Get
End Property

I set the datasource my page_load

Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs)

ReportViewer1.LocalReport.DataSources.Add(New
ReportDataSource("MyDS", ObjectDataSource1.ID))

End Sub

When I run the report I get a

"A data source instance has not been supplied for the data source
'Report_Test_Trap_DataSource2'. "

I think I set this value from the smarttag of the reportviewer already
but I am not sure if it's taking it.

How can I fix this problem?

Thanks,

Burak
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top