WITH thisform ** only create a reference if it does not exist if isnull(.oCon) .oCon = NEWOBJECT('ConMgr','conmgr.prg') endif .nCon = .oCon.OpenConn('itc_H_drive') IF .nCon < 1 MESSAGEBOX('connection failed') RETURN .f. ENDIF MESSAGEBOX('connection successful!!!') SQLSETPROP(.nCon,"Asynchronous",.f.) lnRes = SQLSETPROP( .nCon, "DispWarnings", .F. ) lcSql = "SELECT UD.SSNo, UD.firstname, UD.middle " ; + " FROM UDFields UD " ; + " ORDER BY UD.SSNo " lnRes = SQLEXEC( .nCon, lcSql, "lcresults" ) SELECT lcresults *BROWSE lnRes = .oCon.CloseConn(.nCon) ** don't release until DESTROY event of form *.oCon = null *RELEASE .oCon ENDWITHThen in the DESTROY event of your form put:
This.oCon = nullPut