The example assumes the existence of the objects SD.DbStruct, Db.Database,
TB.DTable.
Then the particular process DbManager and the correctly configured database with
the particular DSN name via ODBC in the operating
system.
INT _transHandle ; handle for Connection INT _handle ; handle for the access to the database INT _retCode RECORD (SD.DbStruct)_dbRow DB_TRANS_OPEN Db.Database, _transHandle, _retCode
IF _retCode # _ERR_NO_ERROR THEN ; Connection to the database failed
END ENDIF
; opening the table for modification
DB_CONNECT TB.Table, _DB_MODIFY, _handle, _retCode TRANS _transHandle
IF _retCode # _ERR_NO_ERROR THEN ; connection to the table failed
END
ENDIF
; deleting according to key item
_dbRow[1]^Int := 1
DB_READ _handle, _dbRow[1], _retCode
IF _retCode # _ERR_NO_ERROR THEN ; Was the row deleted ?
END
ENDIF
; close the table
DB_DISCONNECT _handle
; conform the transaction
DB_TRANS_COMMIT _transHandle, _retCode
IF _retCode # _ERR_NO_ERROR THEN ; Was the row deleted ?
END
ENDIF
; close Connection to the database
DB_TRANS_CLOSE _transHandle
Related pages:
Pridať komentár