You are not logged in.
Pages: 1
Hi;
I am new bee mormot and delphi.
When I was reading a datetime value from MSSQL 2008 R2 database ;
I have got an error
" ... 0.42936 is not valid timestamp"
But WhenI was execute same SQL statement via SME I saw the datetime value is "2017-07-16 00:00:00"
I am using this code blok like this: (I am verry sorry for big capital . But I am using big capital when I was writing code.)
XQSIPLIST : TSynDBSQLDataSet;
XLIST : TSTRINGLIST;
..
XSQLSTR:='Select INCKEYNO, TARIH, NAME from MYtable';
XQSIPLIST:=TSynDBSQLDataSet.CREATE(nil);
XQSIPLIST.CONNECTION:=mssqldbConnetion; // TSQLDBConnectionProperties . Connect via MSSQL 2008 R2 Client
XQSIPLIST.COMMANDTEXT:=XSQLSTR;
XQSIPLIST.OPEN;
XQSIPLIST.FIRST;
WHILE NOT XQSIPLIST.EOF DO BEGIN
..
XLIST.ITEMS[XROW]:=DATETOSTR(XQSIPLIST.FIELDBYNAME('TARIH').ASDATETIME); // TARIH is a datetime field.
...
XQSIPLIST.NEXT;
END;
XQSIPLIST.CLOSE;
XQSIPLIST.FREE;
How can I retrieve true datetime from this database using TSynDBSQLDataSet.
Can anybody help me ?
Edit : But this Code block is retrieve true datetime value from database
XDBCONNECTION:=TOleDBMSSQLConnectionProperties.Create(....);
XDATA:=XDBCONNECTION.EXECUTE(STRINGTOUTF8(XSQLSTR),[]);
WHILE XDATA.STEP DO BEGIN
XBASTARIH:=XDATA.ColumnDateTime('TARIH'); // TARIH is a TdateTime field
SHOWMESSAGE(XDATETIMETOSTR(XBASTARIH));
END;
sorry for code blocks
Last edited by zekeriye (2017-07-17 11:42:21)
Offline
I want to reading a list (some of records from table) and display them to show in a stringgrid.
Does any advice to solve this problem
or
another methods to reading, showing datetime correct value ?
Offline
Thanks your great support ab;
Now; version 25-07-2017 reading correct datetime value from MSSQL 2008 R2 database.
this version solve ".. is not datetime value" error message.
Offline
Pages: 1