Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi frens, i have a problem while using crystal report
i actually wanted to show the datas dynamically. i only wanted to show the seleted data in crystal report but the report viewer is showing all the datas

i have done something like this

C#
BLLCustomer blc = new BLLCustomer();
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        int custid =Convert.ToInt32(Request.QueryString["customerid"].ToString());
        int addid =Convert.ToInt32( Request.QueryString["addressid"].ToString());

        DataTable dt = blc.getAllByCustomerID(custid);
        ReportDocument rptdc = new ReportDocument();
        rptdc.Load("C:\\Users\\Bishnu\\Documents\\Visual Studio 2008\\WebSites\\Assignment1\\CrystalReport.rpt");
        rptdc.SetDataSource(dt);
        CrystalReportViewer1.Visible = true;
        CrystalReportViewer1.ReportSource = rptdc;
    }
}

in the BLLCustomer, i have the method to get all the fields of customer and i retrieved the customerid and addressid from query string but it is still showing whole of the datas in crystal reporting

please help me by showing my error
with regards bishnu

[edit]Code block added, "Treat my content as plain text..." option disabled - OriginalGriff[/edit]
Posted
Updated 24-Dec-11 1:43am
v2

Refresh the report.
C#
DataTable dt = blc.getAllByCustomerID(custid);
ReportDocument rptdc = new ReportDocument();
rptdc.Load("C:\\Users\\Bishnu\\Documents\\Visual Studio 2008\\WebSites\\Assignment1\\CrystalReport.rpt");
rptdc.SetDataSource(dt);
CrystalReportViewer1.Visible = true;
CrystalReportViewer1.ReportSource = rptdc;
CrystalReportViewer1.Refresh();//This line

For your information
C# Crystal Reports Tutorial[^]
 
Share this answer
 
Comments
Monjurul Habib 24-Dec-11 9:00am    
5!
Abhinav S 24-Dec-11 9:20am    
5!
i checked that the datatable dt is returning only selected value but the crystal report viewer is not showing only single record rather showing all of them
so what is the main error please help
with regards bishnu karki
 
Share this answer
 
Comments
RaviRanjanKr 24-Dec-11 9:26am    
A suggestion :- you can use Have a question or Comment button to drop your message and to get Immediate response instead of posting as 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