I tried to do this function but it doesn't turn me at all I don't understand where I'm wrong
sample of Usage
oCustomers:Open_Db( "customer", , {FIRST,LAST} )
oCustomers:SetOrder( "FIRST" )
oCustomers:GoTop()
- Code: Select all Expand view RUN
FUNCTION Open_Db( cArchivio, aIdx )
LOCAL cAlias
LOCAL oDbf
LOCAL i
STATIC _Select_
DEFAULT _Select_ := 0
cAlias := "TD" + PADL( ++_Select_, 3, "0" )
DbUseArea( .T. ,, cArchivio, cAlias, .T. )
IF VALTYPE( aIdx ) == "A"
FOR i := 1 TO LEN( aIdx )
DBSETINDEX( aIdx[ i ] )
NEXT
ENDIF
oDbf := TDatabase():Open(,cAlias)
RETURN oDbf
return me a message "TD0001.dbf not avaible"
then I tried with
- Code: Select all Expand view RUN
- FUNCTION Open_Db( cArchivio, aIdx )
LOCAL cAlias
LOCAL oDbf
LOCAL i
STATIC _Select_
DEFAULT _Select_ := 0
oDbf := TDatabase():Open(,cArchivio)
IF VALTYPE( aIdx ) == "A"
FOR i := 1 TO LEN( aIdx )
DBSETINDEX( aIdx[ i ] )
NEXT
ENDIF
RETURN oDbf
but make error because
Error description: Error DBCMD/2001 Workarea not in use: ORDLISTADD
Stack Calls
===========
Called from: => ORDLISTADD( 0 )
Called from: ../../../rddord.prg => DBSETINDEX( 0 )
what do you recommend?