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

Discussion in 'C#' started by hoodaki, Feb 1, 2012.

  1. #1
    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
     
    hoodaki, Feb 1, 2012 IP
  2. aidanriley

    aidanriley Banned

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    51
    #2
    What is it that you're trying to do? Some kind of math operation on that timestamp?
     
    aidanriley, Feb 1, 2012 IP