Click here to Skip to main content

Mrugesh08 asked:

Open original thread
Hello sir.
 
I want to search between Two dates in crystal report...but im not getting Proper output..my code is below....plz help me.....
 
protected void Page_Load(object sender, EventArgs e)
    {
        DataSet1 ds = new DataSet1();
        DataSet1TableAdapters.job_tableTableAdapter da = new DataSet1TableAdapters.job_tableTableAdapter();
        da.Fill(ds.job_table);
        CrystalReportSource1.ReportDocument.SetDataSource(ds);
    }
    protected void CrystalReportViewer1_Init(object sender, EventArgs e)
    {
 
    }
    protected void RadButton1_Click(object sender, EventArgs e)
    {
        DataSet1 ds = new DataSet1();
 
        DataSet1TableAdapters.job_tableTableAdapter da = new DataSet1TableAdapters.job_tableTableAdapter();
        da.Fill(ds.job_table);
 
        CrystalReportSource1.ReportDocument.SetDataSource(ds);
 
        if (RadDatePicker1.SelectedDate.HasValue && RadDatePicker2.SelectedDate.HasValue)
        {
            CrystalReportViewer1.SelectionFormula = "{job_table.date}>=#" + RadDatePicker1.SelectedDate.Value.ToShortDateString() + "# and {job_table.date}<=#" + RadDatePicker2.SelectedDate.Value.AddDays(0).ToShortDateString() + "#";
 
        }
        else if (RadDatePicker1.SelectedDate.HasValue)
        {
            CrystalReportViewer1.SelectionFormula = "{job_table.date}>=#" + RadDatePicker1.SelectedDate.Value.ToShortDateString() + "# and {job_table.date}<=#" + RadDatePicker1.SelectedDate.Value.AddDays(0).ToShortDateString() + "#";
 
            //CrystalReportViewer1.SelectionFormula = "{Bill_gen.DOO}>=#" + RadDatePicker1.SelectedDate.Value.ToShortDateString() + "#";
        }
        else
        {
 
        }
    }
 }
Tags: C#

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).



Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid