TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
amber
NA
39
48k
How To Pass Date Parameter in RDLC Report C# winform app ?
Jun 11 2014 6:59 AM
Hi,
I am using VS 2013 C# and MS-ACCESS DB.
I wana filter my RDLC report with date parameter but with only a year. I couldnt find the code for RDLC. All i could find was for .rdl for SSRS but my case is different.
Objective:
RDLC report will be filtered with Catagory, and current Year and User can also filter it with prev. years. But the default value for date parameter will be Current year.
ISSUE:
I have defined a custom format in Access DB as 'yyyy' then in DataSet1 i have added in Fill method as Fill(Cat, Year). Previously i was filtering the report with only Catagory and used following code:
this.DataTable1TableAdapter.Fill(this.DataSet1.DataTable1, comboBox1.Text);
Was working fine. On Report1.rdlc there are two row grps Parent grp: Catagory and child grp: Faculty. on winform i have 1 combobox for CAT and 1 textbox for Year then from report data window i have added date parameter(Session) and also st its default value through xpression builder as
DateTime.Now
. and used the following code:
DataSet1TableAdapters.DataTable1TableAdapter ta = new DataSet1TableAdapters.DataTable1TableAdapter();
DataSet1.DataTable1DataTable dt = new DataSet1.DataTable1DataTable();
ta.Fill(dt, comboBox1.Text, Convert.ToDateTime(textBox1.Text));
ReportDataSource rds = new ReportDataSource();
rds.Name = "DataSet1";
rds.Value = dt;
ReportParameter rp = new ReportParameter("Session", textBox1.Text.ToString());
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.ReportPath = "Report1.rdlc";
reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp });
reportViewer1.LocalReport.DataSources.Add(rds);
reportViewer1.LocalReport.Refresh();
bt its throwing th exception 'String is not recognized as valid 'datetime'
Can't i filter the report with custom format i.e. yyyy? I have also removed the parameter and tried it with follwoing simple code:
this.DataTable1TableAdapter.Fill(this.DataSet1.DataTable1, comboBox1.Text, Convert.ToDateTime(textBox1.Text));
this.reportViewer1.RefreshReport(); showing
An error occurred during local report processing!
Should i aslo add a row grp for year?Or on which grp should i add it parent grp 'catagory' or child grp 'faculty'??Please guide there are so many ways and i have tried so many. Please help me with ds m lost in codes now.
Thanx in advance,
Reply
Answers (
0
)
Bulk Updation
Aligment issue in Crystal Report