Jul 16, 2009 04:24 AM|soupmano|LINK
I'm trying to do something so simple I can't believe I creating a thread. I want to pull Events from the Event table that are within a range of time.The RecordedTime field is a datetime field (SQL EXpress 2008 in this case).With the following code (DH object
being a class that offers me shortcuts to the ODBCDataAdapter/ODBCCommand objects) I get the following error:
ERROR  [Microsoft][SQL Server Native Client 10.0]Datetime field overflow. Fractional second precision exceeds the scale specified in the parameter binding.
SQLQuery += "SELECT count(*) as cnt FROM Event ";
SQLQuery += "WHERE RecordedTime BETWEEN ? AND ? ";
DH.Query(SQLQuery, DT, false);
If I replace the code piece that says DateTime.Now.AddHours(-1) and replace it DateTime.Now, all works well and the query goes through but returns no results.
Anybody has an idea.