my small sample access-database contains one table with three fields and four recordsets. To browse it, I use following code:
- Code: Select all Expand view
function browsen()
local oWin2
local oConnection := TOleAuto():New( "ADODB.Connection" )
local oRecordSet
local oBrw
DEFINE WINDOW oWin2 MDICHILD FROM 5, 7 TO 17, 40 TITLE "XBrowse"
oConnection:Open( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=gilbert.mdb; Persist Security Info=False" )
oRecordSet:=TOleAuto():New( "ADODB.Recordset" )
oRecordSet:Open( "SELECT * FROM Name", oConnection )
msginfo(oRecordSet:Fields( "Name" ):Value) // Here I get a value = "Hans"
msginfo(oRecordSet:RecordCount()) // Here the response = "-1"
oBrw:=TXbrowse():New(oWin2)
oBrw:SetAdo( oRecordSet )
oBrw:Createfromcode()
oWin2:SetControl(oBrw)
ACTIVATE WINDOW oWin2
return .t.
When I call "msginfo(oRecordSet:Fields( "Name" ):Value)" I get "Hans" as an answer, what is the content of Name in the first record. But when I call "msginfo(oRecordSet:RecordCount())" the answer is "-1".
As a consequence, xbrowse does not show any records. I get the same behaviour with mysql-databases.
Can somebody help me?