View Full Version : bindValue string to datetime db field

19th September 2009, 10:48
I have strange problem.
I use bindValue to bind date ( saved in qstring, format yyyy-MM-dd ) to db datetime field.
And I get error: Arithmetic overflow error converting expression to data type datetime.
If I write this in this way: bindValue( ":dateFrom", "2009-01-01" ) it is correct.
If I write this in that way: bindValue( ":dateFrom", elem.getDateFrom() ) it is error.
def of getDateFrom(): const QString& getDateFrom() const;
Any ideas??

Ok, I also use ODBC Driver... and ODBC driver need date format: yyyyMMdd
So simple conversion do QVariant:: Date should work... :)