Problem with TDataRow and number

Problem with TDataRow and number

Postby Maurizio » Tue Oct 04, 2016 7:26 am

Hello
there is a problem in the class TDataRow

METHOD Modified call the Method EqualVal

For the problem of floating point arithmetic ( https://groups.google.com/forum/#!starr ... XRFGCDhSzQ )
the line

lEq := ( x == y )

sometimes return .f. even if the numbers are equal and Modified() return .t.
with ADO this generates an error in ::SaveADO oRs:Update( aCols, aVals )

Regards Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem with TDataRow and number

Postby nageswaragunupudi » Tue Oct 04, 2016 8:06 am

lEq := ( x == y )

sometimes return .f. even if the numbers are equal and Modified() return .t.

I agree that this is possible at times.
Do you have any suggestions? What about
lEq := ( cValToChar( x ) == cValToChar( y ) ) ?

with ADO this generates an error in ::SaveADO oRs:Update( aCols, aVals )

I do not understand why this should give an error? In the worst case a field us updated with the same value and this should not raise an error. Can you please help me to understand better?
Regards

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

Re: Problem with TDataRow and number

Postby Maurizio » Tue Oct 04, 2016 8:38 am

I try
lEq := ( cValToChar( x ) == cValToChar( y ) ) ?
but dosn't work

for the moment I use

IF Str( oRec:TOT_DOC, 16, 2 ) != Str( oRec:TOT_DOC , 16, 2 )
//? "Different values"
oRec:TOT_DOC := ::nTotaleFattura
ENDIF


I do not understand why this should give an error? In the worst case a field us updated with the same value and this should not raise an error. Can you please help me to understand better?


I have this error http://i.imgur.com/CRYOfdn.png
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem with TDataRow and number

Postby nageswaragunupudi » Tue Oct 04, 2016 8:51 am

Can you be kind enough to translate the error message into English?
Regards

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

Re: Problem with TDataRow and number

Postby Maurizio » Tue Oct 04, 2016 9:06 am

Unable to locate the row specified for the upgrade is possible that some values have changed since the last read


I have this error when I do
oRs:update() without changing any data in oRs .
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem with TDataRow and number

Postby nageswaragunupudi » Tue Oct 04, 2016 10:03 am

May I know if the table has a primary key and the sql includes the primary key?
Do you mind reproducing the sql statement for creating the record set?
Regards

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

Re: Problem with TDataRow and number

Postby Maurizio » Tue Oct 04, 2016 10:46 am

May I know if the table has a primary key ?


Yes

and the sql includes the primary key?


sorry I dont understand

Do you mind reproducing the sql statement for creating the record set?


Code: Select all  Expand view
oRs :=  FW_OpenRecordSet( M->oServer ,"select * from lis_fat where lis_fat.nume = 1234 " )
 oRec  := TDataRow():New( oRs)
.
.
 
  // IF Str(  oRec:TOT_DOC, 16, 2 ) != Str(  nTotaleFattura , 16, 2 )
  //     ? "Different values"
        oRec:TOT_DOC    := ::nTotaleFattura                 //  Totale documento
  //  ENDIF

.
.

 oRec:Save()
 
 oRs:Close()
 
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem with TDataRow and number

Postby nageswaragunupudi » Tue Oct 04, 2016 11:41 am

This kind of error can occur when either the ADO does not know the primary key and does not know where to save or if the record is modified by some other routine in our program.

The solution is not avoid saving, but ensure proper saving. I am trying to figure out what must be happening
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 114 guests