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

Recommended Answers

All 2 Replies

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;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.