Esta es una versión alternativa usando las funciones más recientes implementadas en FWH:
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oCn, oRs, cTable
oCn := FW_OpenAdoConnection( "Provider='Microsoft.Jet.OLEDB.4.0'; Data Source='xbrtest.mdb';" )
if oCn != nil
oRs := oCn:OpenSchema( 20 )
#ifdef __XHARBOUR__
oRs:cClassName := "RECORDSET" // due to a bug in xbrowse.prg. Fixed in FWH13.05
#endif
XBROWSER oRs TITLE "Select a table" ;
COLUMNS { "TABLE_NAME" } SELECT ( cTable := oBrw:aCols[ 1 ]:Value )
oRs:Close()
if ! Empty( cTable )
if ' ' $ cTable
cTable := '[' + cTable + ']'
endif
if ( oRs := FW_OpenRecordSet( oCn, cTable ) ) != nil
XBROWSER oRs AUTOSORT
oRs:Close()
else
? "Failed to open " + cTable
endif
endif
oCn:Close()
else
? "Connection Fail"
endif
return nil