PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET DataTable.Select DateTime problem

Reply

DataTable.Select DateTime problem

 
Thread Tools Rate Thread
Old 11-04-2006, 06:15 PM   #1
=?Utf-8?B?L2Rldi9udWxs?=
Guest
 
Posts: n/a
Default DataTable.Select DateTime problem


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:
  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off