Click here to Skip to main content
15,912,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Expert,

I am using vs.net 2008 and using asp.net c sharp.

I am producing report using crystal report based on category.

On report button click i have add following code.

Int64 currCatId = Convert.ToInt64(lstCategory.SelectedValue);
     try
     {
        // string queryStr = "SELECT cmp.campaign_name,cmp.campaign_status,cmp.start_date,cmp.end_date,cmp.num_sent,cmp.budgeted_cost,cat.category as cat_id   FROM  crm_campaign cmp INNER JOIN crm_category cat ON cmp.cat_id=cat.cat_id where cmp.cat_id=" + currCatId + "";
         string queryStr = "SELECT cmp.*   FROM  crm_campaign cmp  where cmp.cat_id=" + currCatId + "";


         ClassDtBaseConnect clsDtResult = new ClassDtBaseConnect();
         DataTable dt = clsDtResult.GetDataTable(queryStr);

         ReportDocument myreportDoc = new ReportDocument();
         myreportDoc.Load(Server.MapPath("TestingCrystalReport.rpt"));
         myreportDoc.SetDataSource(dt);
         CrystalReportViewer1.ReportSource = myreportDoc;
        // CrystalReportViewer1.RefreshReport();

     }
     catch (Exception Ex)
     {

     }


its showing proper results from database according to selected category.

But when i click print option from crystal report,it display all results from database without selected category and print all rows also.This problems also comes in exporting option.

How i print and export categorywise results.And crystal report is not compulsary for me.

Thanks in advance.
Posted
Comments
santosh pabba 30-Dec-11 7:08am    
may i know have you pasing the samething to reports or given any direct connection to Crystal reports.......

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