RowFilter Multiple Expr

Moishe

Member
Joined
May 30, 2003
Messages
24
Hi All
I have a textBoxName, startDate and endDate

What string should I put in the rowfilter so after it would give me the name rows for all days like between these days in my dataview.

this is how it is in the select comment

select textBoxName from table where [date] between startDate and endDate

Thanks for your help
 
Try something like:
C#:
ds.Tables["Table1"].DefaultView.RowFilter = "[date] BETWEEN " + txtStart.ToString("mm/dd/yyyy") + " AND " + txtEnd.ToString("mm/dd/yyyy") + "";

I havent tried it, but I believe the RowFilter supports BETWEEN with Dates. The rest is just formatting...

If it doesnt support BETWEEN with dates, you can use a >= and <= solution.

-Nerseus
 
Thanks for your reply.

I converted to vb.net and it didnt work not only BETWEEN but als AND keywords
and how can I also selec customer name in the same rowfilter

Thanks for your help
 
The between didnt work for me either, but you can use the AND method. Try this:
C#:
ds.Tables["Table1"].DefaultView.RowFilter = "[date] >= " + txtStart.ToString("mm/dd/yyyy") + " AND [date] <= " + txtEnd.ToString("mm/dd/yyyy") + "";

You can just add " AND name like jon%" to the end (or however you want to code your customer name filter) to filter by customer name.

-Ner
 
Back
Top