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 6 Years Ago by __avd: Added [code] tags. For easy readability, always wrap programming code within posts in [code] (code blocks).

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;
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.