Hi,
I am doing research to implement ado/sql with my companies Xharbour application, which is now based on dbf technology. I have a class pbrowse which inherit Twbrowse.
My question: Should I still use Twbrowse and modify it, so that it works with ado/sql or should I use another class (for example xbrowse)?
I think one advantage of using Twbrowse is that it is based on the original code of the xharbour application of my company.
I like to know some opinions.
Kind regards,
Pieter
Twbrowse with ado/sql
- Antonio Linares
- Site Admin
- Posts: 42513
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: Twbrowse with ado/sql
Pieter,
As I commented to Erwin, to me the shortest and easiest way is to implement a Method SetAdo() for your Class PBrowse().
You may use Class TXBrowse Method SetAdo() as a reference and Class TWbrowse Method SetArray() as the template to follow.
As I commented to Erwin, to me the shortest and easiest way is to implement a Method SetAdo() for your Class PBrowse().
You may use Class TXBrowse Method SetAdo() as a reference and Class TWbrowse Method SetArray() as the template to follow.
Re: Twbrowse with ado/sql
Antonio,
Thank you.
I tried to make something, but I am not sure if I understand your advice.
I thought I also can do something with ::bline in pbrowse (which come from twbrowse).
While I am writing this post, I suddenly get more ideas again. So later I can further investigate the possible solutions again.
Thanks again:D.
Kind regards,
Pieter
Thank you.
I tried to make something, but I am not sure if I understand your advice.
Code: Select all | Expand
CLASS pbrowse From twbrowse
//All METHODS and VARS of pbrowse
METHOD SetAdo()
ENDCLASS
METHOD SetAdo( oRs, lAddCols, lAutoOrder, aFldNames ) CLASS pbrowse
//I could make here a TXBrowse object. (I already made something like that before and it worked fine), however I am not sure whether this is the best //solution, because I did not see a way to make it compatible with the other (dbf based) methods and vars of pbrowse.
Return Self
I thought I also can do something with ::bline in pbrowse (which come from twbrowse).
While I am writing this post, I suddenly get more ideas again. So later I can further investigate the possible solutions again.
Thanks again:D.
Kind regards,
Pieter
- Antonio Linares
- Site Admin
- Posts: 42513
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 31 times
- Been thanked: 73 times
- Contact:
Re: Twbrowse with ado/sql
Pieter,
Try this:
Try this:
Code: Select all | Expand
METHOD SetAdo( oRs, cAlias ) CLASS PBrowse
::cAlias = cAlias
::bLogicLen = {|| oRs:RecordCount() }
::bGoTop = {|| If( oRs:RecordCount() > 0, oRs:MoveFirst(), nil ) }
::bGoBottom := {|| If( oRs:RecordCount() > 0, oRs:MoveLast(), nil ) }
::bSkip := {| n | AdoSkip( oRs, IfNil( n, 1 ) ) }
return nil
Code: Select all | Expand
function AdoSkip( oRs, n )
LOCAL nRec
if oRs:RecordCount() == 0
return 0
endif
nRec := oRs:AbsolutePosition
If( oRs:Eof, oRs:MoveLast(), If( oRs:Bof, oRs:MoveFirst(),) )
oRs:Move( n )
If( oRs:Eof, oRs:MoveLast(), If( oRs:Bof, oRs:MoveFirst(),) )
return oRs:AbsolutePosition - nRec