FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ADO AbsolutePosition in 64bit problem
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
ADO AbsolutePosition in 64bit problem
Posted: Wed Jul 13, 2016 10:12 AM
Hi,

In my 32bit version I use this code to update a query, and stay on the same record.
Code (fw): Select all Collapse
vrec := oRs:AbsolutePosition
oRs:Requery()
oRs:AbsolutePosition(vrec)

and is working fine.

In the 64bit-version I receive an error on the 3the line where I set the position again.
vrec is holding the line-number, just like in the 32bit version. I debugged it, and is the value of the record, just like in the 32-bit version.
Code (fw): Select all Collapse
Error description: (DOS Error -2147352562) WINOLE/1007  Argument error: ABSOLUTEPOSITION
Args:
   [   1] = N   2

Is there another way to do this?
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: ADO AbsolutePosition in 64bit problem
Posted: Wed Jul 13, 2016 01:19 PM
Marc

You can always do this the brute force way by saving your primary key to a variable and then requery and go back and find ..

Code (fw): Select all Collapse
Local nPrimKey

nPrimKey := oRs:Fields("<your nPrim key>"):Value
oRs:ReQuery()

oRs:MoveFirst()
oRs:Find( "<your nPrim key> = "+ltrim(str(nPrimKey))


May not be pretty, but it should work..

Rick Lipkin
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM
Re: ADO AbsolutePosition in 64bit problem
Posted: Wed Jul 13, 2016 01:55 PM
Hi,

I found the solution. :-)
Code (fw): Select all Collapse
oRs:AbsolutePosition := vrec

is working
Strange that in the other release
Code (fw): Select all Collapse
oRs:AbsolutePosition(vrec)
also works :-)
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: ADO AbsolutePosition in 64bit problem
Posted: Wed Jul 13, 2016 02:15 PM

Marc

I like your solution much better and more elegant. Thanks for the feedback!

Rick Lipkin

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: ADO AbsolutePosition in 64bit problem
Posted: Wed Jul 13, 2016 02:55 PM
Marc Vanzegbroeck wrote:Hi,

I found the solution. :-)
Code (fw): Select all Collapse
oRs:AbsolutePosition := vrec

is working
Strange that in the other release
Code (fw): Select all Collapse
oRs:AbsolutePosition(vrec)
also works :-)


AbsolutePosition isn't a method so the assignment is the correct way.

EMG
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: ADO AbsolutePosition in 64bit problem
Posted: Thu Jul 14, 2016 05:25 PM

I'm not certain which class is in use in this case, but looking at the source to TArrData and TRecSet I see that AbsolutePosition is an access value, and AbsolutePosition() is an assignment method. Give this I would expect oRS:AbsolutePosition := N to fail.

---------- TARRDATA.PRG
ACCESS AbsolutePosition INLINE ::nAt
ASSIGN AbsolutePosition( x ) INLINE ::nAt := x

---------- TRECSET.PRG
ACCESS AbsolutePosition INLINE If( ::Empty, 0, ::oRs:AbsolutePosition )
ASSIGN AbsolutePosition( n ) ;
INLINE If( ::Empty, nil, ::oRs:AbsolutePosition := ::rs_FitRange( n ) )

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: ADO AbsolutePosition in 64bit problem
Posted: Thu Jul 14, 2016 05:41 PM
AbsolutePosition is a property not a method. Please look at the MS docs:

https://msdn.microsoft.com/en-us/library/ms676594(v=vs.85).aspx

EMG

Continue the discussion