Click here to Skip to main content
16,021,115 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all
how to create crystal reports . i have two textboxes first textbox is from date and second textbox is to date i want to display report between fromdate and todate report.
in asp.net usig c#.please send me any one.
thankyou.
Posted

Try This :

take both date value in to QueryString as:

string from_date = Request.QueryString["fromdate"];
string to_date = Request.QueryString["todate"];


import these namespace first :
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Reporting;

declare variable like :
ReportDocument cr;


then apply query :

protected void Page_Init(object sender, EventArgs e)
{

 String data = "SELECT * from table name where from_date>='"+from_date+"' and to_date<='"+to_date+"';

        SqlDataAdapter ad1 = new SqlDataAdapter(data, connection object);
        DataSet ds1 = new DataSet();
        ad1.Fill(ds1);


       path = Server.MapPath("Reportname");
        cr = new ReportDocument();
        cr.Load(path);

        cr.SetDataSource(ds1.Tables[0]);
        CrystalReportViewer1.ReportSource = cr;

}


if any problem you get, please post it...
 
Share this answer
 
v2
Comments
Member 8584763 1-Nov-12 14:50pm    
is there another way beside using this
string from_date = Request.QueryString["fromdate"];
string to_date = Request.QueryString["todate"];

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