-2

I have a table in SQL Server 2008 like this:

CREATE TABLE B_INTERVENTION ( 
ID_BI INT IDENTITY PRIMARY KEY NOT NULL ,
Date_Creation DATE NOT NULL ,
Cree_Par INT NOT NULL ,
D_Arr BIT NOT NULL ,
Obj_Demarrage DATE NOT NULL ,
Obj_Fin DATE NOT NULL ,
Type_BI CHAR (2) NOT NULL ,
INSPECT INT NOT NULL ,
VERIF INT NOT NULL ,
Machine VARCHAR (13) NOT NULL ,
Priorite INT NOT NULL ,
Date_Fin_Trav DATETIME NULL ,
Commentaire VARCHAR(80) NULL
)
GO

When I try to set the value of Date_Fin_Trav to a TDateTimePicker I get ann error in this line:

DateTimePicker1.DateTime := FDTable1Date_Fin_Trav.Value;

Error:

[Dcc32 Error] Unit1.pas (53): E2010 Incompatible types: 'TDateTime' and 'TSQLTimeStamp'

So I change the code to:

DateTimePicker1.DateTime := TimeStampToDateTime( FDTable1Date_Fin_Trav.Value);

Also get an error because the Type:

[Dcc32 Error] Unit1.pas (53): E2010 Incompatible types: 'TTimeStamp' and 'TSQLTimeStamp'

So my question is : How to convert TSQLTimeStamp to TDateTime?

Ilyes
  • 14,640
  • 4
  • 29
  • 55

1 Answers1

3

Use the SQLTimeStampToDateTime() function in the Data.SqlTimSt unit:

Converts a TSQLTimeStamp value to a TDateTime value.

Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
Christine Ross
  • 465
  • 5
  • 14