Click here to Skip to main content
12,954,522 members (53,252 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
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
        {
 
        }
    }
 }
Posted 28-Dec-12 22:14pm
Updated 28-Dec-12 22:18pm
v3
Comments
Mrugesh08 29-Dec-12 5:13am
   
plz help me.......

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

try like these code:

OracleCommand cmd = new OracleCommand("select * from TRANSACTION WHERE TRANSDATE >=to_date('" + stdate + "') AND TRANSDATE<=to_date('" + todate + "') Order by TRANSDATE", conn);
  Permalink  

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,539
CHill60 3,490
Maciej Los 3,153
ppolymorphe 2,030
Jochen Arndt 1,975


Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100