Even after that wait for about 100 secs or so before assuming that you are totally detached from the mdb.
James Bott wrote:Even after that wait for about 100 secs or so before assuming that you are totally detached from the mdb.
I assume this is to wait for the write cache to be written to disk. I know the COMMIT command is for DBF's but I wonder if it just forces the write cache for the entire app to be written? Maybe try it.
Regards,
James
nageswaragunupudi wrote:When you close the recordset, you call oRs:Close(), but never close the connection explicitly. That means the connection is still active and open even after you closed recordset.
If you adopt the approach of opening recordsets with connection strings, when u close the recordset, please
oRs:Close()
oRs:ActiveConnection:Close()
Rick Lipkin wrote:I added the ActiveConnection:CLose() after the recordset close() and INDEED the .ldb went away.
oRs = CREATEOBJECT( "ADODB.Recordset" )
oRs:Open( ... )
...
oRs:Close()
oRsUser := CREATEOBJECT( "ADODB.Recordset" )
*oRsUser := TOleAuto():New( "ADODB.Recordset" )
*oRsUser:CursorType := 1 // opendkeyset
*oRsUser:CursorLocation := 3 // local cache
*oRsUser:LockType := 3 // lockoportunistic
cSQL := "SELECT * From [Staff] Order by [Lname]"
TRY
oRsUser:Open(cSQL,xConnect, 1, 3 )
CATCH oErr
MsgInfo( "Error in Opening Staff table" )
RETURN(.F.)
END TRY
...
...
oRsUser:CLose()
#define adOpenForwardOnly 0
#define adOpenKeyset 1
#define adOpenDynamic 2
#define adOpenStatic 3
#define adLockReadOnly 1
#define adLockPessimistic 2
#define adLockOptimistic 3
#define adLockBatchOptimistic 4
#define adUseNone 1
#define adUseServer 2
#define adUseClient 3
FUNCTION MAIN()
TEST()
INKEY( 0 )
RETURN NIL
STATIC FUNCTION TEST()
LOCAL oRs := CREATEOBJECT( "ADODB.Recordset" )
oRs:CursorLocation = adUseClient
oRs:Open( "SELECT * FROM Clienti ORDER BY Cliente", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clienti.mdb", adOpenForwardOnly, adLockReadOnly )
WHILE !oRs:EOF
? oRs:Fields( "Cliente" ):Value
oRs:MoveNext()
ENDDO
oRs:Close()
RETURN NIL
xPROVIDER := "Microsoft.Jet.OLEDB.4.0"
xSOURCE := cDEFA+"\Groom.mdb"
xPASSWORD := "xxxxxxxx"
xCONNECT := 'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Jet OLEDB:Database Password='+xPASSWORD
oRsUser := CREATEOBJECT( "ADODB.Recordset" )
*oRsUser := TOleAuto():New( "ADODB.Recordset" )
*oRsUser:CursorType := 1 // opendkeyset
oRsUser:CursorLocation := 3 // local cache
*oRsUser:LockType := 3 // lockoportunistic
cSQL := "SELECT * From [Staff] Order by [Lname]"
TRY
oRsUser:Open(cSQL,xConnect, 0, 1 )
CATCH oErr
MsgInfo( "Error in Opening Staff table" )
RETURN(.F.)
END TRY
msginfo( "Check ldb" )
oRsUser:CLose()
SysReFresh()
Msginfo( "Check Closed" )
Return(.f.)
Enrico Maria Giordano wrote:Rick,
You didn't get the point. You must test the LDB when oRs has gone out of scope. Please, test my exact sample changing only the connection string and the query.
EMG
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 93 guests