Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,
I am trying to get records whose dates are between two date on report.rdlc using report viewer.
On button click data Table contains 5 records but my Report.rdlc is showing only top most record from data table.
I want to display all records from table in report.rdlc.
I am using C# 4.0 windows application and MSSQL 2008.
Plz help.
Thanks you.
Posted
Updated 12-Sep-21 11:44am
Comments
george4986 4-Mar-14 1:49am    
post ur code here

try this

supposing ur datatable column in rdlc is coln_date

on ur Rdlc Design section

right click corresponding tabledetails cell

select 'Expression'

on the above box remove the First function

ie

C#
=First(Fields!coln_date.Value)


TO

C#
=Fields!coln_date.Value
 
Share this answer
 
Comments
Member 10641030 4-Mar-14 2:28am    
Thanks for the answer.
My old code is

=First(Fields!Name.Value, "AD")

i have changed to

=Fields!Name.Value

but it is showing only top most record from data table.
Plz help.
george4986 4-Mar-14 2:31am    
if u are running rdlc from application.startuppath
copy modified rdlc there and run again
Member 10641030 4-Mar-14 2:37am    
private void btnprint_Click(object sender, EventArgs e)
{
DateTime from = Convert.ToDateTime(dtpFrom.Text);
DateTime to = Convert.ToDateTime(dtpTo.Text);
string str = "Select * from Sales where Date BETWEEN '" + from + "' and '" + to + "'";
SqlDataAdapter da = new SqlDataAdapter(str, con);
DataTable dt = new DataTable();
da.Fill(dt);
Microsoft.Reporting.WinForms.ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource("AD", dt);
reportViewer1.LocalReport.ReportEmbeddedResource = "AutoZone.Report.rdlc";
rds.Name = "AD";
rds.Value = dt;
reportViewer1.LocalReport.DataSources.Add(rds);
reportViewer1.RefreshReport();
}
here is my code on button click.
what i have to change.
Thanks.
george4986 4-Mar-14 3:07am    
whats the content of dt?
Member 10641030 4-Mar-14 3:17am    
dt having
Name, Number, Address.
when i debug, it shows dt has 3 rows.
but rdlc is showing only top most row data.
Problem solved.
I have used Table to display the fields.
Due to Some Frustration there is always confusion.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900