function testsql3
local oCn, oRs
local nDecimals
oCn := FW_OpenAdoConnection( "test3.db" )
if oCn:State < 1
? "fail"
return nil
endif
TRY
oCn:Execute( "DROP TABLE NUMDEC" )
CATCH
END
// Create Table and populate data
FWAdoCreateTable( "NUMDEC", { { "DATE", 'D', 8, 0 }, ;
{ "NDECIMALS", 'N', 2, 0 } }, oCn, .f. )
oRs := FW_OpenRecordSet( oCn, "NUMDEC" )
oRs:AddNew( { "Date", "NDECIMALS" }, { Date(), 3 } )
oRs:Close()
// Open Table and Use data
oRs := FW_OpenRecordSet( oCn, "NUMDEC" )
nDecimals := oRs:Fields( "nDecimals" ):Value
? nDecimals, ValType( nDecimals )
msginfo( Str( 88.456, 10, 3 ) )
msginfo( Str( 88.456, 10, nDecimals ) )
oRs:Close()
oCn:Close()
return nil
Antonio Linares wrote:Marco,
In your example please change this line:
msginfo(str(88.456,10, Int( nDecimals ) )) && RETURN 88 !!!
Antonio Linares wrote:Marco,
Is it working fine with Harbour ?
Marco Turco wrote:Hi,
no I didn't. As you can see the self-contained is very minimal.
---
#include "fivewin.ch"
procedure start()
oSQLite := TSQLiteServer():New( "test.sql" )
If oSQLite:lError
msgStop( "error" )
RETURN
EndIf
cQuery:="SELECT * from t_tables;"
oQry:=oSQLite:Query(cQuery)
nDecimals:=oQry:aData[1,7]
oQry:End()
oSQLite:End()
msginfo(ndecimals) && return 3
msginfo(valtype(ndecimals)) && return N
msginfo(str(88.456,10,3)) && return 88.456
msginfo(str(88.456,10,nDecimals)) && RETURN 88 !!!
return
function gettemppath()
return("")
#include "fivewin.ch"
procedure start()
Local ndecimals := 0 //
#include "fivewin.ch"
procedure start()
Local nTest_Decimals := 3
oSQLite := TSQLiteServer():New( "test.sql" )
If oSQLite:lError
msgStop( "error" )
RETURN
EndIf
cQuery:="SELECT * from t_tables;"
oQry:=oSQLite:Query(cQuery)
nTest_Decimals :=oQry:aData[1,7]
oQry:End()
oSQLite:End()
msginfo(nTest_Decimals ) && return 3
msginfo(valtype(nTest_Decimals )) && return N
msginfo(str(88.456,10,3)) && return 88.456
msginfo(str(88.456,10,nTest_Decimals )) && RETURN 88 !!!
return
function gettemppath()
return("")
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 37 guests