User-125438676 posted
I am new to the ReportViewer control and I think I'm trying to do something that cannot be done. The page itself is very simple, just a form with a control:
<body>
<form id="form1" runat="server">
<div>
<rsweb:reportviewer
id="rvCapacityPlanning"
width="800px"
Font-Size="8pt"
Height="600px"
runat="server" />
</div>
</form>
</body>I created a Dataset but canceled out of the configuration wizard and just added a DataTable with some columns. In the code behind on my page I have the following:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Set the processing mode for the ReportViewer to Local
rvCapacityPlanning.ProcessingMode = ProcessingMode.Local
Dim rep As LocalReport = rvCapacityPlanning.LocalReport
rep.ReportPath = "rptCapacityPlanning.rdlc"
Dim rds As New ReportDataSource
rds.DataSourceId = "ObjectDataSource1"
Dim EmployeeData As EmployeeData = GetSalesData()
'Create a report data source for the sales order data
Dim dsCapacityPlanning As New ReportDataSource
dsCapacityPlanning.Name = "EmployeeData_Data"
dsCapacityPlanning.Value = EmployeeData.Tables("Data")
rvCapacityPlanning.LocalReport.DataSources.Clear()
rvCapacityPlanning.LocalReport.DataSources.Add(dsCapacityPlanning)
End Sub
Private Function GetSalesData()
Dim ds As New EmployeeData
Dim oConn As New SqlConnection(GetConnectionString)
Dim oCmd As New SqlCommand
Dim iYear As Integer = 2008
Dim sITCostCenter As String = ""
Dim sWebUser As String = "a76211"
With oCmd
.Connection = oConn
.CommandType = CommandType.StoredProcedure
.CommandText = "sp_getProjectHoursByOrgByProjByEmployee"
.Parameters.Add("@rptYear", SqlDbType.Int).Value = iYear
.Parameters.Add("@ITCostCenter", SqlDbType.VarChar).Value = sITCostCenter
.Parameters.Add("@webuser", SqlDbType.VarChar).Value = sWebUser
Dim salesOrderAdapter As New SqlDataAdapter(oCmd)
salesOrderAdapter.Fill(ds, "Data")
salesOrderAdapter.Dispose()
.Dispose()
End With
Return ds
End Function
When I try to run the report I get the following error:'A data source instance has not been supplied for the data source 'DataSet1_DataTable1'.I've been trying to re-do this all day and I just keep running into roadblocks. The name of the DataSet,
the one stored in App_Code, is also called EmployeeData. Hoping someone has some input on this.TIA, N