Hello,
DateTime fields are only shown and edited as Date fields in ADO.
Thank you.
#include "fivewin.ch"
#include "adodef.ch"
#define USE_ADO
static oCn
static cTable := "testdatetime"
//----------------------------------------------------------------------------//
function Main()
local cSql, oRs
SET DATE ITALIAN
SET CENTURY ON
SET TIME FORMAT TO "HH:MM:SS"
oCn := FW_DemoDB( "ADO" ) // or connec to your MySql server
TRY
oCn:Execute( "DROP TABLE testdatetime" )
CATCH
END
TEXT INTO cSql
CREATE TABLE `testdatetime` (
`ID` INT AUTO_INCREMENT PRIMARY KEY,
`NAME` VARCHAR ( 20 ),
`DTIME` DATETIME
)
ENDTEXT
oCn:Execute( cSql )
cSql := "INSERT INTO testdatetime ( NAME, DTIME ) VALUES ( 'One', '2018-10-20' )"
oCn:Execute( cSql )
oRs := FW_OpenRecordSet( oCn, "select * from testdatetime" )
? oRs:Fields( "dtime" ):Type, ;
oRs:Fields( "dtime" ):Value, ;
ValType( oRs:Fields( "dtime" ):Value )
MakeDialog( oRs )
oRs:Close()
oCn:Execute( "DROP TABLE testdatetime" )
oCn:Close()
return nil
//----------------------------------------------------------------------------//
static function MakeDialog( oRs )
local oDlg
DEFINE DIALOG oDlg SIZE 250,150 PIXEL TRUEPIXEL
@ 20,60 GET oRs:Fields( "name" ):Value SIZE 150,24 PIXEL OF oDlg
@ 50,60 GET oRs:Fields( "dtime" ):Value SIZE 150,24 PIXEL OF oDlg
@ 90,60 BUTTON "OK" SIZE 100,40 PIXEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
return nil
//----------------------------------------------------------------------------//
? oRs:Fields( "dtime" ):Type, ;
oRs:Fields( "dtime" ):Value, ;
ValType( oRs:Fields( "dtime" ):Value )
@ r,c GET oRs:Fields( "dtime" ):Value
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 69 guests