Antonio
Returned .f. ...
... kinda thought that. From everything I have read .. MS SQL server uses the indexes in the execution plan if it is a faster way to get at the data .. but not truly to be used or manipulated by a program. In Oracle .. there is a 'hint' clause that tells the query to use the index ..
This is not a 'deal buster' for me .. perhaps you can add an optional <order by> to be used by the SQL query like .. "Select * from userinfo order by userid" .. will need some way to tap into the oRs:Find() method from your code.... here is what I was doing in ADO .. this is the "find" program .. where the cert table is ordered by reg_no .. so that is the sort of the table :
//---------------------------------
DO CASE
CASE cITEM = "Reg Number "
cFIND := ALLTRIM(SUBSTR(cFIND,1,2)+SUBSTR(cFIND,4,5))
oRs:Find("reg_no = '"+cFIND+"'" )
IF oRs:eof
oRs:MoveFirst()
xFIND := "reg_no like '"+cFIND+"%'"
oRs:Find( xFIND )
IF oRs:eof()
Msginfo( "Reg Number "+cFind+" can not be found" )
oRs:MoveFirst()
ENDIF
ENDIF
RETURN(.T.)
CASE cITEM = "Name "
oRs:Filter := "name like '"+cFIND+"%'"
IF oRs:eof
oRs:MoveFirst()
xFIND := "name like '"+cFIND+"%'"
oRs:Find( xFIND )
IF oRs:eof()
Msginfo( "Name "+cFind+" can not be found" )
oRs:MoveFirst()
ENDIF
ENDIF
RETURN(.T.)
ENDCASE
//---------
Since I would also have to locate on a name field .. there was no way to re-order the table unless closed and re-creaded the recordset ordered by name .. to at least make the program usable .. I used the 'filter' method to give the user the opportunity to locate by a name out of the origional recordset .. and have a 'clear filter' option to bring back all the records again ..
A bit clumsy but it works ..
Was hoping there was a 'magic wand' you could wave to use ADO see and manipulate the MS SQL indexes .. it appears ADO can see the index and know it by name .. just not use it to find records or order or re-order a recordset.. as in SET INDEX to ..
Looks like the best thing you can do is add an additional <order by> option for those databases that do not support indexing... and let our developers know that is just a limitation they will have to deal with ..
Just my thoughts.
Rick Lipkin