G
Guest
DataTable.Select DateTime problem
Hello,
i am using the select method on a datatable to obtain rows that correspond
to a range of dates.
The application works fine under some regional settings in windows xp:
English(USA) and French(Canada) but fails to work the i select French(France)
from the control panel.
i am using visual studio .net 2003 (vb.net, .net framework 1.1)
I isolated a bit of code that goes like this :
DataSetBills.myDataTable.Locale = CultureInfo.CurrentCulture
Dim FilterExpression As String
FilterExpression = "((CreationDate >= #" + DateMonday.ToString("d",
DataSetBills.myDataTable.Locale) + "# and CreationDate <= #" +
DateSunday.ToString("d", DataSetBills.myDataTable.Locale) + "#)"
'this line causes problems:
DataSetBills.myDataTable.DefaultView.RowFilter = FilterExpression
When i check the objects in the quickwatch windows they seem to have the
same shortdatepattern format but the thing still raises the same exception.
It works when i replace the first line with :
DataSetBills.myDataTable.Locale =
System.Globalization.CultureInfo.InvariantCulture
I don't understand what is going on.
My code was first like this (and it worked) :
DataSetBills.myDataTable.Locale = CultureInfo.CurrentCulture
Dim FilterExpression As String
FilterExpression = "((CreationDate >= #" + DateMonday.ToString + "# and
CreationDate <= #" + DateSunday.ToString + "#)"
'this line causes problems:
Hello,
i am using the select method on a datatable to obtain rows that correspond
to a range of dates.
The application works fine under some regional settings in windows xp:
English(USA) and French(Canada) but fails to work the i select French(France)
from the control panel.
i am using visual studio .net 2003 (vb.net, .net framework 1.1)
I isolated a bit of code that goes like this :
DataSetBills.myDataTable.Locale = CultureInfo.CurrentCulture
Dim FilterExpression As String
FilterExpression = "((CreationDate >= #" + DateMonday.ToString("d",
DataSetBills.myDataTable.Locale) + "# and CreationDate <= #" +
DateSunday.ToString("d", DataSetBills.myDataTable.Locale) + "#)"
'this line causes problems:
DataSetBills.myDataTable.DefaultView.RowFilter = FilterExpression
When i check the objects in the quickwatch windows they seem to have the
same shortdatepattern format but the thing still raises the same exception.
It works when i replace the first line with :
DataSetBills.myDataTable.Locale =
System.Globalization.CultureInfo.InvariantCulture
I don't understand what is going on.
My code was first like this (and it worked) :
DataSetBills.myDataTable.Locale = CultureInfo.CurrentCulture
Dim FilterExpression As String
FilterExpression = "((CreationDate >= #" + DateMonday.ToString + "# and
CreationDate <= #" + DateSunday.ToString + "#)"
'this line causes problems: