I tried to executing a testxbr3.Prg sample with my database configurations... I need some assistance:
The function to connect... That's ok!
- Code: Select all Expand view
static function ConnectToMySql
local lConnect := .f.
//local cStr := "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + ;
// cFilePath( hb_argv( 0 ) ) + "xbrtest.mdb;User Id=admin;Password=;"
local cStr := 'Provider=MSDASQL.1;' +;
'Extended Properties="DATABASE=genesis;DRIVER={MySQL ODBC 5.1 Driver};' +;
'Server=localhost;User=genesis;Password=genesis;Port=3306;Option =3"'
if oCon == nil
oCon := TOleAuto():new("ADODB.Connection")
oCon:ConnectionString := cStr
TRY
oCon:Open()
lConnect := .t.
CATCH
oCon := nil
MsgInfo('Connect Fail')
return nil
END
else
lConnect := .t.
endif
return lConnect
The function to get the recordset.... oRs:recordCount() returns a error!
- Code: Select all Expand view
static function GetRecSet
static oRs
local oRecSet
ConnectToMySql()
if oCon != nil .and. oRs == nil
oRs := TOleAuto():new( "ADODB.RecordSet" )
// oRs:ActiveConnection := oCon
// oRs:Source := 'select * from documentos_series'
oRs:LockType := 4 // adLockOptimistic
oRs:CursorLocation := 3 //adUseClient
// oRs:CacheSize := 100
TRY
oRs:Open( 'select * from documentos_series', oCon, 3 ) // Only by this way work!
? oRs:fields("codigo_serie"):value, oRs:fields("descricao"):value // Show me the respective values at first row of dataset
CATCH
MsgInfo('Access Table Open Failure')
return nil
END
endif
? oRs:recordCount() // Give me a error!
return oRs
The error on error.log
- Code: Select all Expand view
Application
===========
Path and name: H:\apps\FWH8.10\FWH\samples\testxbr3.exe (32 bits)
Size: 2,022,912 bytes
Time from start: 0 hours 1 mins 11 secs
Error occurred at: 23-01-2009, 10:01:22
Error description: Error ADODB.RecordSet/6 DISP_E_UNKNOWNNAME: RECORDCOUNT
Args:
Stack Calls
===========
Called from: source\rtl\win32ole.prg => TOLEAUTO:RECORDCOUNT(0)
Called from: testxbr3.prg => GETRECSET(1046)
Called from: testxbr3.prg => ADOBRWALLCOLSWIN(343)
Called from: testxbr3.prg => (b)MAINMENU(87)
Called from: .\source\classes\MENU.PRG => TMENU:COMMAND(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:COMMAND(0)
Called from: .\source\classes\MDIFRAME.PRG => TMDIFRAME:COMMAND(0)
Called from: => TMDIFRAME:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: testxbr3.prg => MAIN(42)