>*!* You must have already established an ADO Connection Object. >*!* The assumption is that you establish this connection when >*!* the application is started and the object reference is being >*!* stored in either a public/private variable [this is OK] or an >*!* Application Object [goApp, better way]. Then set the value of >*!* the oADO_Conn property in this CA baseclass to the goApp >*!* property or variable. >LOCAL luOldValue >luOldValue = THIS.oADO_Conn >IF TYPE("THIS.oADO_Conn") = "C" AND NOT EMPTY(THIS.oADO_Conn) > *!* converts the property value from a string to an object ref > THIS.oADO_Conn = EVALUATE(THIS.oADO_Conn) >ENDIF >IF TYPE("THIS.oADO_Conn.Provider") <> "C" > *!* if the Provider property does not exist, > *!* the object is not an OLEDB provider. > THIS.oADO_Conn = luOldValue > RETURN .F. >ENDIF >THIS.oADO_RS = NEWOBJECT('ADODB.Recordset') >THIS.oADO_Command = NEWOBJECT('ADODB.Command') >IF TYPE("THIS.oADO_RS") <> "O" OR TYPE("THIS.oADO_Command") <> "O" > RETURN .f. >ENDIF >THIS.oADO_Command.ActiveConnection = THIS.oADO_Conn >WITH THIS.oADO_RS > .ActiveConnection = THIS.oADO_Conn > .CursorType = 1 && adOpenKeyset > .CursorLocation = 3 && adUseClient > .LockType = 3 && adLockOptimistic >ENDWITH >THIS.DataSource = THIS.oADO_RS >IF NOT THIS.lAutoGenerate > THIS.UpdateCmdDataSourceType = [ADO] > THIS.UpdateCmdDataSource = THIS.oADO_Command > THIS.DeleteCmdDataSourceType = [ADO] > THIS.DeleteCmdDataSource = THIS.oADO_Command > THIS.InsertCmdDataSourceType = [ADO] > THIS.InsertCmdDataSource = THIS.oADO_Command >ENDIF >