- Code: Select all Expand view
- #include "FiveWin.ch"
#include "xbrowse.ch"
#include "xhb.ch"
function Main()
local oCon := TOleAuto():New( "ADODB.Connection" )
local oCat := TOleAuto():New( "ADOX.Catalog" )
local oRs := TOleAuto():New( "ADODB.Recordset" )
local aTables := {}, cTable, oError
try
oCon:Open( "Provider='Microsoft.Jet.OLEDB.4.0'; Data Source='xbrtest.mdb';" )
catch oError
MsgInfo( oError:Description )
end
oCat:ActiveConnection = oCon
oRs = oCon:OpenSchema( 20 ) // adSchemaTables
while ! oRs:Eof()
AAdd( aTables, oRs:Fields:Item( "Table_Name" ):Value )
oRs:MoveNext()
end
XBROWSER aTables SELECT cTable := aTables[ oBrw:nArrayAt ]
oRs:Close()
oRs:CursorType = 1 // opendkeyset
oRs:CursorLocation = 3 // local cache
oRs:LockType = 3 // lockoportunistic
if ! Empty( cTable )
try
oRs:Open( "SELECT * FROM " + cTable, oCon ) // Password="abc" )
catch oError
MsgInfo( oError:Description )
end
XBrowser( oRS )
endif
return nil