Good point, Peter Joseph – Also just rediscovered that we have no less than five methods of firing stored procs in our wrappers, all processing arguments in different ways.
Double-check the parameters datatype: we had this problem when the parameter was interpreted as a double and not as a TDateTime. During the call, the date was converted to float, passed to the server as a float and re-converted to a sql datetime. This leads to the 2 day offset, since in delphi TDateTime(0) = ‘1899-12-30’ and in mssql cast(0 as datetime) = ‘1900-01-01’
Giacomo Degli Esposti – That was indeed the problem. What fixed it was formatting the date as a string in the format that the db was set up for. The developer said “Don’t tell anyone” as this was the method used numerous other places in the code 🙂 The underlying cause appears to be that TDateTime turns to Double in a Variant array.
If it’s mssql Why don’t you use the Sql profiler in Ssms
Good point, Peter Joseph – Also just rediscovered that we have no less than five methods of firing stored procs in our wrappers, all processing arguments in different ways.
Double-check the parameters datatype: we had this problem when the parameter was interpreted as a double and not as a TDateTime. During the call, the date was converted to float, passed to the server as a float and re-converted to a sql datetime. This leads to the 2 day offset, since in delphi TDateTime(0) = ‘1899-12-30’ and in mssql cast(0 as datetime) = ‘1900-01-01’
Giacomo Degli Esposti – That was indeed the problem. What fixed it was formatting the date as a string in the format that the db was set up for. The developer said “Don’t tell anyone” as this was the method used numerous other places in the code 🙂 The underlying cause appears to be that TDateTime turns to Double in a Variant array.
Lars Fosdal LOL. Don’t worry, this will stay a secret between you and me! 😉