PDA

View Full Version : Cannot perform '<=' operation on MySql.Data.Types.MySqlDateTime and System.String.



hooda
02-01-2012, 04:35 AM
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

qdb
02-01-2012, 06:33 AM
use between instead
where EDD_DT between '2011-03-17' and '2011-03-18'