- Code: Select all Expand view
- #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()
LOCAL cCns := "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyDatabase.mdb"
LOCAL oCn, oRs
FERASE( "MyDatabase.mdb" )
CREATEOBJECT( "ADOX.Catalog" ):Create( cCns )
oCn = CREATEOBJECT( "ADODB.Connection" )
oCn:Open( cCns )
oCn:Execute( "CREATE TABLE Test ( Id COUNTER PRIMARY KEY, Test NUMERIC ( 7, 2 ) )" )
oRs = CREATEOBJECT( "ADODB.Recordset" )
oRs:CursorLocation = adUseClient
oRs:Open( "SELECT * FROM Test", oCn, adOpenForwardOnly, adLockOptimistic )
oRs:AddNew()
oRs:Fields( "Test" ):Value = 10.5
oRs:Update()
? oRs:Fields( "Test" ):Value
oRs:Requery()
? oRs:Fields( "Test" ):Value
oRs:Close()
oCn:Close()
RETURN NIL
EMG