Sent by Michael Wheat on 06/13/2005 08:41:21 AM:
Hi FoxWeb Support Team,
If I create a Cursor Adapter Object based on my subclass. When I try to compile the other prg that the class is in, I get the following error.
Error while compiling c:\program files\foxweb\programs\olbproc.prg: File cannot be closed because outstanding references exist. (1184)
The following is the code used to create the object.
What am I doing wrong that does not destroy the object reference?
loOLBids = NEWOBJECT("caOLBids")
if VARTYPE(loOLBids) != "L"
if loOLBids.CursorFill()
Response.Write([CursorFill() Success])
else
Response.Write([CursorFill() Failed])
endif
else
Response.Write([Connect Failed])
endif
loOLBids = .F.
RELEASE loOLBids
RETURN
***************************************************************
* OLBids CursorAdapter
***************************************************************
DEFINE CLASS caOLBids AS CursorAdapter
cConnStr = "DRIVER={MySQL ODBC 3.51 Driver};" +;
"DESC=;DATABASE=****;" +;
"SERVER=****;" +;
"UID=****;PASSWORD=****;PORT=****;"+;
"OPTION=3;STMT;"
SelectCmd = "SELECT * FROM OLBIDS"
Tables = "OLBIDS"
KeyFieldList = "OLBRECID"
UpdatableFieldList = "OLBRECID, STKNO, BUYCODE, SALEDATE, BIDDATETIME, BIDAMT, CURRBID, TYPE"
UpdateNameList = ;
"OLBRecId OLBids.OLBRecId,"+;
"StkNo OLBids.Stkno,"+;
"BuyCode OLBids.BuyCode,"+;
"SaleDate OLBids.SaleDate,"+;
"BidDateTime OLBids.BidDateTime,"+;
"BidAmt OLBids.BidAmt,"+;
"CurrBid OLBids.CurrBid,"+;
"Type OLBids.Type"
Alias = "OLBIDS"
BufferModeOverride = 5
DataSourceType = "ODBC"
FUNCTION Init() AS Boolean
LOCAL lnConn AS Integer
SET MULTILOCKS ON
lnConn = SQLSTRINGCONNECT(This.cConnStr)
IF lnConn > 0
This.DataSource = lnConn
ENDIF
lnConn = NULL
RETURN This
ENDFUNC
FUNCTION Destroy()
IF This.DataSource > 0
SQLDISCONNECT(This.DataSource)
ENDIF
This.DataSource = NULL
RETURN DODEFAULT()
ENDFUNC
ENDDEFINE
Thank you,
Mike