SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2011
    Location
    London
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    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. #2
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,653
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    The issue 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. Do you have a way of feeding the criteria in as a MySqlDateTime rather than a string?


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •