Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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

"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
Posted

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

  • *Experts*
Posted

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

"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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...