Cannot perform '<=' operation on MySql.Data.Types.MySqlDateTime and System.String.

Discussion in 'Website Development & Design' started by brijeshtiwari198, Feb 1, 2012.

  1. brijeshtiwari198

    brijeshtiwari198
    uix_expand uix_collapse
    New Member

    Joined:
    Dec 27, 2011
    Messages:
    5
    Likes Received:
    0
    Hi all,

    Hoping someone might have an answer to this.

    I am build an DataView from a DataTable where the source data is from MySQL.

    I dynamically build a selection criteria which works great except for the dates in the source table.

    I have tried the following 3 methods and get three different errors:

    ( ETD_DT <= '2011-03-17 12:11:31' ) and (ETA_DT >= '2011-03-17 12:11:31' )

    gives me an error that says
    "Cannot perform '<=' operation on MySql.Data.Types.MySqlDateTime and System.String."

    So I tried:

    ( ETD_DT <= #2011-03-17# ) and (ETA_DT >= #2011-03-17# )

    gives me an error that says
    "Cannot perform '<=' operation on MySql.Data.Types.MySqlDateTime and System.DateTime."


    So I tried:

    ( ETD_DT <= {ts '2011-03-17 12:44:03'} and ETA_DT >= {ts '2011-03-17 12:44:03'} )
    gives me an error that says
    Syntax error: Missing operand after ''2011-03-17 12:47:47'' operator
     
  2. Bliss Elliosn

    Bliss Elliosn
    uix_expand uix_collapse
    Member

    Joined:
    Apr 28, 2011
    Messages:
    154
    Likes Received:
    28
    Since you are 'Date' datatype, according to my little knowledge, < and > operators are not applied to that DateTime datatype. 'BETWEEN' and 'AND' operators I know are used for Date and Time datatypes. You may research further in this regard.
     
    • Like Like x 1
  3. band

    band
    uix_expand uix_collapse
    Member

    Joined:
    Oct 15, 2011
    Messages:
    183
    Likes Received:
    36
    BAF is more focus on business relate topic, for technical question you may get a better through Digital point, sitepoint, stack overflow or V7N.
     
  4. Fergal

    Fergal
    uix_expand uix_collapse
    Premium Member
    Premium Member

    Joined:
    Nov 18, 2007
    Messages:
    10,575
    Likes Received:
    1,165
    band as Bliss has shown in his post above we also have members here with good technical knowledge who can answer questions like this :)
     
  5. MariaFrolova

    MariaFrolova
    uix_expand uix_collapse
    Member

    Joined:
    Jan 10, 2012
    Messages:
    29
    Likes Received:
    1
    seems to be that the designers of the mysql library decided they needed their own DateTime type and didn't bother to implement the overloads for comparison operators with typical System.DateTimes properly
     
  6. cesspadilla

    cesspadilla
    uix_expand uix_collapse
    Active Member

    Joined:
    Sep 8, 2011
    Messages:
    705
    Likes Received:
    194
    Eventhough we are a business forum, we can still extend our hands to those members who asks technical questions like that. I think we have a really good members knowledgeable in that particular subject.
     

Share This Page