ERROR USING TDABASE

ERROR USING TDABASE

Postby gss200610 » Tue Oct 11, 2011 6:07 pm

hello all, I'm having trouble in TDatabase;
I called a number field prcims type number with two decimal places.
and its value is zero.
If I? tdabase-> pricms shows zero, so far ok.
now if TDatabase phaco-> pricms> 0 always returns true and q is zero value.
if I do without the table-type if tdabase> pricms operate normally.
Can someone help me?
gss200610
 
Posts: 36
Joined: Sat Jun 19, 2010 10:09 am
Location: Goiania - Goias - Brasil

Re: ERROR USING TDABASE

Postby nageswaragunupudi » Tue Oct 11, 2011 10:19 pm

Can you post a small sample code to reproduce this error, using any of the dbf files in the fivewin samples folder?

Our tests are running correctly.
For example,
Code: Select all  Expand view
  oDbf := TDataBase():Open( , "c:\fwh\samples\customer.dbf" )
   ? oDbf:Salary  // --> 5900.00
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: ERROR USING TDABASE

Postby gss200610 » Sat Oct 15, 2011 1:15 pm

The problem is, I have a variable number that compares the field tdabase: this value is greater than variable and always returns true, and demonstrate command to see the field and the field is reset. example:

LOCAL nvalor:=0

IF odbf:valor > nvalor
RETURN( .F. )
ENDIF

most always returns true, and both are zero, both the variable as the table field that is numeric.
gss200610
 
Posts: 36
Joined: Sat Jun 19, 2010 10:09 am
Location: Goiania - Goias - Brasil

Re: ERROR USING TDABASE

Postby hmpaquito » Sat Oct 15, 2011 3:10 pm

gss200610,

can you try this code ?

Code: Select all  Expand view
 
LOCAL nvalor:=0

IF Val(Str(odbf:valor)) > nvalor
RETURN( .F. )
ENDIF

 


regards
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: ERROR USING TDABASE

Postby Euclides » Sat Oct 15, 2011 3:54 pm

gss200610,
the code below does not show error
(of course, all the VALOR fields are zeroes) :)
Code: Select all  Expand view

Function main()
local oDbf, nVlr:=0, nCnt:=0
use arquivo
DATABASE oDbf
do while !eof()
   nCnt++
   if oDbf:valor > nVlr
      MsgInfo(nCnt, " ERROR")
   endif
   oDbf:skip()
enddo
   MsgInfo(nCnt, " END")
return nil
 

regards, Euclides
User avatar
Euclides
 
Posts: 156
Joined: Wed Mar 28, 2007 1:19 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 95 guests