ADO AbsolutePosition in 64bit problem

ADO AbsolutePosition in 64bit problem

Postby Marc Vanzegbroeck » 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: Select all  Expand view
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: Select all  Expand view
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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: ADO AbsolutePosition in 64bit problem

Postby Rick Lipkin » Wed Jul 13, 2016 1: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: Select all  Expand view

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
User avatar
Rick Lipkin
 
Posts: 2657
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ADO AbsolutePosition in 64bit problem

Postby Marc Vanzegbroeck » Wed Jul 13, 2016 1:55 pm

Hi,

I found the solution. :D
Code: Select all  Expand view
oRs:AbsolutePosition := vrec

is working
Strange that in the other release
Code: Select all  Expand view
oRs:AbsolutePosition(vrec)
also works :shock:
Regards,
Marc

FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: ADO AbsolutePosition in 64bit problem

Postby Rick Lipkin » Wed Jul 13, 2016 2:15 pm

Marc

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

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2657
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ADO AbsolutePosition in 64bit problem

Postby Enrico Maria Giordano » Wed Jul 13, 2016 2:55 pm

Marc Vanzegbroeck wrote:Hi,

I found the solution. :D
Code: Select all  Expand view
oRs:AbsolutePosition := vrec

is working
Strange that in the other release
Code: Select all  Expand view
oRs:AbsolutePosition(vrec)
also works :shock:


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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8524
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: ADO AbsolutePosition in 64bit problem

Postby rhlawek » Thu Jul 14, 2016 5: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 ) )
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm



Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 24 guests