Dataview Rowfilter

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi,
I want to filter on a date column of my view. I use the following syntax
:
MyDataset.MyTable.DefaultView.RowFilter = "MyDateColumn >= #" & StartingDate
& "# and MyDateColumn <= #" & EndingDate & "#"

It works perfectly until I change my date format to dd.mm.yy. I get an error
message that say ambigous date format. I have tried with the following
syntax :

MyDataset.MyTable.DefaultView.RowFilter = "year(MyDateColumn) = " &
StartingDate.year

But the year() function is not recognized. I was trying to use the year,
month and day function to compare the two dates.

What is the syntax to use, that will works with every date format?

Thanks,

Martin
 
Hi Martin,

Date should be in format mm/dd/yyyy.
Try using this with your first variant:
StartingDate.ToString("MM/dd/yyyy",CultureInfo.InvariantCulture);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top