Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
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
Edited 28-Dec-12 22:18pm
v3
Comments
Mrugesh08 at 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
0 Sergey Alexandrovich Kryukov 383
1 OriginalGriff 304
2 George Jonsson 258
3 Animesh Datta 130
4 Shemeemsha RA 128
0 OriginalGriff 6,099
1 Sergey Alexandrovich Kryukov 5,411
2 CPallini 4,770
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2014
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