Patrick FAURE Guest
|
Posted: Mon Feb 23, 2004 10:25 am Post subject: Time conversion with Format function |
|
|
Hi,
I want to store time data in a table.
I use for this TQuery component.
First I make my SQL statement with Format function.
I decided to use %f parameter for Time data.
AnsiString UsesSQLStatement;
UsesSQLStatement = Format("INSERT INTO %s (IdURi, UseDate,
StartTime, EndTime, Duration, ComputerAddress, Status)
VALUES (%d, "%s", %1.8f, %1.8f, %1.8f, "%s", "%s")",
OPENARRAY(TVarRec,(
asUTableName,
IdURi,
DateToStr(Date()),
(double)DtTmStartTime,
(double)DtTmEndTime,
(double)Duration,
computerAddress,
status)));
QrInsertU->SQL->Add(UsesSQLStatement);
When I run my application, there isan error: Parameter no correct.
When I debug my program I see in SQL statement that my 3 Time
data are converted like this :
0,00,0,00,0,00 and not like the right format that is
0.00,0.00,0.00 so the SQL is not correct.
How can I do to have the correct conversion? Is it a bug of the
Format function ?
Thanks for your answers.
Patrick
|
|