I am using VS 2008 and SQL 2008,.I am trying to build a report using Report viewer using Parameters.I am completly new to this concept,so i was trying to develop using the basic steps as shown in various tutrials.
1> connect to dataset
2- Configure server
3 - table Adapter
4 - Add new report
5 - Drag a table in the Report screen and add the columns
6 * Here i am adding parameters ( fromdate,todate).Please tell me what mistake i am doing
I got to Reports -> ReportParamaters -> Add new Parameter - > fromdate -> type : Datetime. (Same for Todate)
7 - > In the web page. Added 2 textboxes and a button
8 - > Dragged Reportviewer - > choose Datasoure and Report name
Now the code Behind.
On button click
Protected Sub btnView_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnView.Click
Try
setReportParameters()
Me.ReportViewer1.LocalReport.Refresh()
Catch ex As Exception
End Try
End Sub
Private Sub setReportParameters()
Dim Fromdate As New ReportParameter("Fromdate", tbFromDate.Text)
Dim Todate As New ReportParameter("Todate", tbtodate.Text)
Remove step 7 ..... That will be created by the reportviewer. And remove all the code behind Set the Datasource and report path from the viewer's smart tag
just try to remove the setReportParameters() method in your View Button call and check whether report works by directly typing from date and to date.
I think may be its a datetime issue. can you please run the report the way as i said and then confirm?
Ashutosh Pathak
Blog: http://catchcode.blogspot.com Please mark it as answer if it helps, as clicking on the button can save time of others :)
MCP,MCAD,MCSD,MCTS
I did the same way u told me to..but still the same error repeats.When i load the page..
An error occurred during local report processing.
Error during processing of ‘FromDate’ report parameter.
When i click on Run Report button it says
An unexpected error occurred in Report Processing.
Object reference not set to an instance of an object.
I also want to mention When i add Parameters,in the Report design. Report Parameters -> Add Parameters -> In the available values -> i have added the Expression - > =Parameters!FromDate.Value(0)
just write: Parameters!FromDate.Value dont include 0
Ashutosh Pathak
Blog: http://catchcode.blogspot.com Please mark it as answer if it helps, as clicking on the button can save time of others :)
MCP,MCAD,MCSD,MCTS
"Error 2 The report parameter ‘FromDate’ has a DefaultValue or a ValidValue that depends on the report parameter “FromDate”. Forward dependencies are not valid.
"
can you please share your report, we'll look into it and will get back with the latest changed report.
Ashutosh Pathak
Blog: http://catchcode.blogspot.com Please mark it as answer if it helps, as clicking on the button can save time of others :)
MCP,MCAD,MCSD,MCTS
v_himabindu
Member
15 Points
18 Posts
Problem loading a Report in Report Viewer
Apr 09, 2012 10:57 PM|LINK
Hii
I am using VS 2008 and SQL 2008,.I am trying to build a report using Report viewer using Parameters.I am completly new to this concept,so i was trying to develop using the basic steps as shown in various tutrials.
1> connect to dataset
2- Configure server
3 - table Adapter
4 - Add new report
5 - Drag a table in the Report screen and add the columns
6 * Here i am adding parameters ( fromdate,todate).Please tell me what mistake i am doing
I got to Reports -> ReportParamaters -> Add new Parameter - > fromdate -> type : Datetime. (Same for Todate)
7 - > In the web page. Added 2 textboxes and a button
8 - > Dragged Reportviewer - > choose Datasoure and Report name
Now the code Behind.
On button click
Protected Sub btnView_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnView.Click
Try
setReportParameters()
Me.ReportViewer1.LocalReport.Refresh()
Catch ex As Exception
End Try
End Sub
Private Sub setReportParameters()
Dim Fromdate As New ReportParameter("Fromdate", tbFromDate.Text)
Dim Todate As New ReportParameter("Todate", tbtodate.Text)
Me.ReportViewer1.LocalReport.SetParameters(New ReportParameter() {Fromdate, Todate})
End Sub
When i Run the Report I get this Following Error
"
All i can see is the textboxes and Button.When i click on it,nothing happens...
Pleaseeeeeeeeeeeeee help..
"
Basquiat
Contributor
2387 Points
654 Posts
Re: Problem loading a Report in Report Viewer
Apr 10, 2012 01:03 AM|LINK
Ashutosh Pat...
Contributor
5737 Points
1105 Posts
Re: Problem loading a Report in Report Viewer
Apr 10, 2012 09:53 AM|LINK
just try to remove the setReportParameters() method in your View Button call and check whether report works by directly typing from date and to date.
I think may be its a datetime issue. can you please run the report the way as i said and then confirm?
Blog: http://catchcode.blogspot.com
Please mark it as answer if it helps, as clicking on the button can save time of others :)
MCP,MCAD,MCSD,MCTS
v_himabindu
Member
15 Points
18 Posts
Re: Problem loading a Report in Report Viewer
Apr 10, 2012 04:29 PM|LINK
Hii Ashutosh,
I did the same way u told me to..but still the same error repeats.When i load the page..
An error occurred during local report processing.
Error during processing of ‘FromDate’ report parameter.
When i click on Run Report button it says
An unexpected error occurred in Report Processing.
Object reference not set to an instance of an object.
I also want to mention When i add Parameters,in the Report design. Report Parameters -> Add Parameters -> In the available values -> i have added the Expression - > =Parameters!FromDate.Value(0)
Is this correct?
Basquiat
Contributor
2387 Points
654 Posts
Re: Problem loading a Report in Report Viewer
Apr 10, 2012 04:41 PM|LINK
Ashutosh Pat...
Contributor
5737 Points
1105 Posts
Re: Problem loading a Report in Report Viewer
Apr 10, 2012 04:58 PM|LINK
just write: Parameters!FromDate.Value dont include 0
Blog: http://catchcode.blogspot.com
Please mark it as answer if it helps, as clicking on the button can save time of others :)
MCP,MCAD,MCSD,MCTS
v_himabindu
Member
15 Points
18 Posts
Re: Problem loading a Report in Report Viewer
Apr 10, 2012 05:31 PM|LINK
So..When i made the change i got the Build Error
"Error 2 The report parameter ‘FromDate’ has a DefaultValue or a ValidValue that depends on the report parameter “FromDate”. Forward dependencies are not valid.
"
Ashutosh Pat...
Contributor
5737 Points
1105 Posts
Re: Problem loading a Report in Report Viewer
Apr 11, 2012 04:02 AM|LINK
can you please share your report, we'll look into it and will get back with the latest changed report.
Blog: http://catchcode.blogspot.com
Please mark it as answer if it helps, as clicking on the button can save time of others :)
MCP,MCAD,MCSD,MCTS