I need a serious help in reportviewer.
I seen a lot links, tried a lot codes every way but cannot find a proper solution.
Please make me understand and clear my doubts even.
Totally confused which dataset to select during code and what is datasource.value thing which gives me error everytime...
I am showing the steps how I created the report and trying to make it work. This because I might have done any mistake in creating the reports and you people may catch it.
Now the problem is described below,
I have many .rdlc reporting my project.
What I done is
Note : Reportviewer containing form name is Reports.vb
RDLC reports are Reports1.rdlc,Report2.rdlc,...
1) Created Report like Add -> New Item -> Reporting -> Report -> Report1.rdlc
Report Name: Report1.rdlc
2) Then I add dataset from here like this …
3) DataSet properties opens, it even opens DataSource configuration Wizard.
I select stored procedures because I want to fetch data from my stored procedures and pressed Finish.
Here DataSet Name is BonnyDataSet
4) After that, I select data source from dataset properties…
Now what is this Available datasets here in the last…???
And which dataset I have to consider during loading in ReportViewer???
5) Now I organised the column by adding the data columns from dataset1 shown below…
6) Now I added Reportviewer in form Reports.vb and tried a lot of codes….
Showing some of them here.
Private Sub Reports_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
'Select Case PubRepVar
'Case "AccMast"
Dim data As New BonnyDataSet
Dim rds = New ReportDataSource("BonnyDataSet", data)
ReportViewer.LocalReport.DataSources.Clear()
ReportViewer.LocalReport.DataSources.Add(rds) ‘------error here
ReportViewer.LocalReport.ReportEmbeddedResource = "YourProjectNamespace.Report1.rdlc"
ReportViewer.RefreshReport()
'End Select
Catch ex As Exception
MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
I get the error as following:
BC30311 : Value of type 'ReportDataSource' cannot be converted to 'ReportDataSource'
I have no Idea on this error.
Another code I tried is ReportViewer.ProcessingMode = ProcessingMode.Local
Dim localReport As LocalReport
localReport = ReportViewer.LocalReport ‘-------error here
localReport.ReportEmbeddedResource =
"ReportViewerIntro.Report1.rdlc"
Dim dataset As New DataSet("BonnyDataSet")
Here error shows like :
BC30311 : Value of type 'LocalReport' cannot be converted to 'LocalReport'.
And I tried many other but can’t understand what the problem is.
Am I doing something wrong during the creation of .rdlc reports???
Needed help eagerly. Thanx
Dim rds = New ReportDataSource("DataSet1", data)
– GilbyeBonnyDataSet.AccMast_AllDetail
. – GilbyeDim data = BonnyDataSet.AccMast_AllDetail
not working. Nothing working. It says Value type ReportDataSource cannot be converted to ReportDataSource... Now what's this ?? @RezaAghaei – UrushiolImports Microsoft.Reporting.WebForms
This is the only namespace I can see... Yes It's compile time error... @RezaAghaei – UrushiolMicrosoft.Reporting.WinForms
. Probably you are adding a wring dll too. You should have these references:Microsoft.Reporting.WinForms.dll
andMicrosoft.ReportViewer.Common.dll
. ThenImport Microsoft.Reporting.WinForms
namespace. – GilbyeReportViewer
on aForm
, those references will be added automatically, but if you have aMicrosoft.Reporting.WebForm.dll
remove it, also replaceMicrosoft.Reporting.WebForms
withMicrosoft.Reporting.WinForms
namespace. – GilbyeMicrosoft.Reporting.WinForms
... And where to check thisMicrosoft.Reporting.WebForms.dll
??? @RezaAghaei – UrushiolDim data = BonnydataSet.AccMast_AllDetail
it shows error as reference to non shared member required an object reference. 1 more thing, My dataset isBonnyDataSet
and DataTable in it isAccMast_AllDetail
but still I cant selectBonnyDataSet.AccMast_AllDetail
.. AfterBonnyDataSet.
the intellisense shows meAccMast_AllDetailDataTable
`AccMast_AllDetailRow` etc..@RezaAghaei – UrushiolDim data = BonnydataSet.AccMast_AllDetailDataTable
it shows error BonnydataSet.AccMast_AllDetailDataTable` is a class type and cannot be used as an expression.@RezaAghaei – Urushiolthose data BonnyDataSet.AccMast_AllDetail
, create an instance of data set and then callds1.AccMast_AllDetail
with parameters if it has any, it seem to be stored procedure. I can't test how it works, but get data using it and the use data. That's it. – Gilbye