Re: Delphi DateTime is incompatable with SQL Server datetime.



ÐíÔÆ wrote:

In Delphi:
AStartTime: '2006-04-17 00:00:00'
AEndTime : '2006-04-17 23:59:59'
with Parameters do
begin
ParamByName('start_time').Value := StartOfTheDay(AStartTime);
ParamByName('end_time').Value := EndOfTheDay(AEndTime);
end;
And now in SQL Server the parameter turns out to be:
'04 16 2006 12:00:00:000AM'(start time?), '04 17 2006 12:00:00:000AM'(end
time?)

is it a problem of delphi or ado/msdac or sql server?



the problem is when delphi / ODBC extract the parameters info they set it to adDate
TO solve this problem you have to set the oleParameter to adDBTimeStamp like this

ADOQuery1.Parameters.ParamByName('end_time').ParameterObject.Type_ := adDBTimeStamp;

Yoni.
.



Relevant Pages

  • Delphi DateTime is incompatable with SQL Server datetime.
    ... In Delphi: ... And now in SQL Server the parameter turns out to be: ... is it a problem of delphi or ado/msdac or sql server? ...
    (borland.public.delphi.database.ado)
  • Re: Delphi DateTime is incompatable with SQL Server datetime.
    ... And now in SQL Server the parameter turns out to be: ... is it a problem of delphi or ado/msdac or sql server? ...
    (borland.public.delphi.database.ado)
  • Delphi 2006 and SQL Server
    ... Congratulations to all the guys at Borland. ... Delphi 2006 is a great ... The application that I have developed is a Delphi VCL Win32 ... there has not been enough emphasis at Borland to support SQL Server. ...
    (borland.public.delphi.non-technical)
  • Re: SQL Server Mobile Edition & C#
    ... Sorry but I am not familiar enough with Delphi 6 to answer. ... >> .Net Compact Framework MVP ... >>>>> and modify SQL Server Mobile databases using the SQL server GUI. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: MSDE Performance and Reliability
    ... to other Delphi databases? ... SQL Server Express is very fast. ... Server, there are better solutions for Delphi available, that are not only ... Hannes Danzl [NexusDB Developer] ...
    (borland.public.delphi.database.ado)