[Mono-bugs] [Bug 655211] New: Difference in datetime comparison using DataTable.Select

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 22 04:36:38 EST 2010


https://bugzilla.novell.com/show_bug.cgi?id=655211

https://bugzilla.novell.com/show_bug.cgi?id=655211#c0


           Summary: Difference in datetime comparison using
                    DataTable.Select
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: x86-64
        OS/Version: RHEL 5
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: stefano.sapienti at apsystems.it
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3)
Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)

Hi, I've found a different behaviour between Mono and MS.Net using
DataTable.Select with datetime filters.
MS.Net use always english format, Mono use the current locale.
The problem is that developing in MS.Net for non-English locale I'm forced to
specify .ToString("MM/dd/yyyy") and when I deploy on a Mono system I obtain an
error.

Reproducible: Always

Steps to Reproduce:
DataSet dsResult = new DataSet();
DataTable dtResult = new DataTable();
dtResult.Columns.Add("DATA", typeof(DateTime));
dtResult.Rows.Add(new object[]{DateTime.Now});
dsResult.Tables.Add(dtResult);

//string format="<your format>";

dsResult.Tables[0].Select(DATA >= #" + DateTime.Today.ToString(format) + "#")

Actual Results:  
with english locale
format="MM/dd/yyyy"; //works on Mono and MS.Net
format="dd/MM/yyyy"; //error on Mono and MS.Net

with italian locale
format="MM/dd/yyyy"; //error on Mono, works on MS.Net
format="dd/MM/yyyy"; //works on Mono, error on MS.Net



Expected Results:  
Propbably Mono have a better behaviour than MS.Net cause it filters with the
currente locale instead of forcing format but we should not expect the same
behaviour on both systems?

I'm working with asp.net so I change locale using

<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="it-IT"
uiCulture="it-IT" />

The error is

System.FormatException: String was not recognized as a valid DateTime. 
at System.DateTime.Parse (System.String s, IFormatProvider provider,
DateTimeStyles styles) [0x00000] 
at System.DateTime.Parse (System.String s, IFormatProvider provider) [0x00000] 
at System.DateTime.Parse (System.String s) [0x00000] 
at Mono.Data.SqlExpressions.Tokenizer.ParseToken () [0x00000] 
at Mono.Data.SqlExpressions.Tokenizer.advance () [0x00000] 
at Mono.Data.SqlExpressions.Parser.yyparse (yyInput yyLex) [0x00000] 
at Mono.Data.SqlExpressions.Parser.Compile (System.String sqlExpr) [0x00000] 
at System.Data.DataTable.Select (System.String filterExpression, System.String
sort, DataViewRowState recordStates) [0x00000] 
at System.Data.DataTable.Select (System.String filterExpression) [0x00000]

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list