0

hi all,

i have some dates in my dataset n i want to filter it with 'between' keyword like this:

dataset.Tables[Table_Name].DefaultView.RowFilter = "DATE BETWEEN '"+startDate.ToShortDateString() +"' AND '"+endDate.ToShortDateString()+"'";

But rowfilter doesnot support between keyword.. so i tried this:

dataset.Tables[Table_Name].DefaultView.RowFilter = "'" +startDate.ToShortDateString() + "'<=DATE AND DATE<='" + endDate.ToShortDateString()+ "'";
dataview = new DataView(dataset.Tables[Table_Name]);
dataview = dataset.Tables[Table_Name].DefaultView;
dataGridView1.DataSource = dataview;

And its still not working... dunno wat the problem is coz it does not show any error.. i guess there's some logical error in it...
any one plzz help me out in this as it's getting on ma nerves...

Edited by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Syeda.farwa
0
dataview = dataset.Tables[Table_Name].DefaultView;
dataview.RowFilter = "DATE>='"  + startDate.ToShortDateString() + "' and DATE<='" + endDate.ToShortDateString()+ "'";
dataGridView1.DataSource = dataview;
0
dataview = dataset.Tables[Table_Name].DefaultView;
dataview.RowFilter = "DATE>='"  + startDate.ToShortDateString() + "' and DATE<='" + endDate.ToShortDateString()+ "'";
dataGridView1.DataSource = dataview;
dataview = dataset.Tables[Table_Name].DefaultView;
dataview.RowFilter = "DATE>#"  + startDate.ToShortDateString() + "# and DATE<=#" + endDate.ToShortDateString()+ "#";
dataGridView1.DataSource = dataview;
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.