Moishe Posted July 9, 2003 Posted July 9, 2003 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 Quote
*Experts* Nerseus Posted July 9, 2003 *Experts* Posted July 9, 2003 Try something like: ds.Tables["Table1"].DefaultView.RowFilter = "[date] BETWEEN '" + txtStart.ToString("mm/dd/yyyy") + "' AND '" + txtEnd.ToString("mm/dd/yyyy") + "'"; I haven't tried it, but I believe the RowFilter supports BETWEEN with Dates. The rest is just formatting... If it doesn't support BETWEEN with dates, you can use a >= and <= solution. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Moishe Posted July 9, 2003 Author Posted July 9, 2003 Thanks for your reply. I converted to vb.net and it didn't work not only BETWEEN but als AND keywords and how can I also selec customer name in the same rowfilter Thanks for your help Quote
*Experts* Nerseus Posted July 9, 2003 *Experts* Posted July 9, 2003 The between didn't work for me either, but you can use the AND method. Try this: 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 Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.