database actions in this presentation… –database actions –database connections –recordsets

Post on 12-Jan-2016

247 Views

Category:

Documents

5 Downloads

Preview:

Click to see full reader

TRANSCRIPT

database actions

• In this presentation…

– database actions– database connections– recordsets

database actions

• database actions

– used to control database access– connecting, browsing, updating, deleting– searching support– transaction support

database actions

• database connections

– creating a database connection object– object can be passed to some database actions– similar concept to DDE link object– connection objects also used for RPC– connection specifies host type and database

database actions

• database connection strings

– encode all parameters needed to connect to database

– dependant on provider– same as used in data control

database actions

• recordsets

– represents a collection of records– can be a file, table or stored procedure results– returned by connection action– used by most browse, update and navigation actions

database actions

ActionsDBAddNew creates a new record in a Recordset.DBBeginTrans begins a new transaction.DBCancelUpdate cancels any changes made to the current record of a Recordset.DBClose closes an open Recordset.DBCommitTrans saves any changes and ends the current transaction.DBConnect opens a connection to a data source.DBDelete deletes the current record from a Recordset.DBDisconnect closes a connection to a data source.DBFind searches a Recordset for the row that satisfies the specified criteria.DBMove moves to the first, last, next, or previous record in a Recordset.DBOpen opens a Recordset.DBRollbackTrans cancels any changes and ends the current transaction.DBSeek searches the index of a Recordset to locate the record that matches the specified values.DBUpdate saves any changes made to the current record of a Recordset.

database actions

• DBConnect

– establishes connection to remote data source– Connection String builder to create the string– user name and password prompted if not provided

database actions

• DBConnect arguments

– Connection• name of the connection object created

– Server• data source type• DBServerADO or DBServerDDM

– Connection String• specifies the details required to connect to the server

database actions

• DBOpen

– used to open a recordset– if recordset is empty then EOF and BOF are both set

to True (additions allowed)

database actions

• DBOpen arguments

– Recordset• specifies the name of the recordset object to be

created

– Connection• specifies the connection to use

– Source• for DDM, the file name• For ADO, varies according to CommandType

database actions

• DBOpen arguments

– Cursor Location• DBUseServer• DBUseClient• ignored for DDM

– Cursor Type• DBOpenDynamic• DBOpenForwardOnly• DBOpenKeyset• DBOpenStatic• DBOpenUnspecified

database actions

• DBOpen arguments

– LockType• DBLockOptimistic• DBLockPessimistic• DBLockReadOnly• DBLockUnspecified

– CommandType• DBCmdFile• DBCmdStoredProc• DBCmdTable• DBCmdTableDirect• DBCmdText

database actions

• DBClose

– used to close a recordset object– an error is produced if an update is outstanding– call DBUpdate or DBCancelUpdate first

database actions

• DBClose arguments

– Recordset• specifies the recordset to close

database actions

• DBDisconnect

– disconnects a data connection– closes any active recordsets– an error is generated if a transaction is in progress

database actions

• DBDisconnect arguments

– Connection• specifies the connection to close

database actions

• DBUpdate

– used to saves changes to the current record in a recordset

– cursor position in not changed

database actions

• DBUpdate arguments

– Recordset• specifies the name of the recordset object to update

database actions

• DBCancelUpdate

– used to cancel any changes made to the current record since the last DBUpdate action

– updates need to be cancelled or updated before moving the cursor position

database actions

• DBCancelUpdate arguments

– Recordset• specifies the name of the recordset object for which

updates should be cancelled

database actions

• DBAddNew

– used to create a new record in an updatable recordset

– changes are kept locally until DBUpdate or DBCancelUpdate is called

database actions

• DBAddNew arguments

– Recordset• name of the recordset object to which the new record

should be added

database actions

• DBDelete

– deletes the current record from a recordset– after deleting the record move to another record

database actions

• DBDelete arguments

– Recordset• specifies the name of the recordset from which the

current record should be deleted

database actions

• DBFind

– searches a recordset for a row that matches the search criteria

– EOF and BOF both set to True if no match is found– an error occurs if the current row position is not set

prior to DBFind– only supported for ADO data sources

database actions

• DBFind arguments

– Recordset• recordset to be searched

– Search Criteria• specify a column name, comparison operator and

target value• single column expressions only

– Find Option• DBFindBackward or DBFindForward

database actions

• DBSeek

– used to search the index of a recordset– EOF property set to True if no match found– depends on provider support– DDM allows DBSeek for keyed files– Supports Seek displayed in database description tool

database actions

• DBSeek arguments

– Recordset• specifies the name of the recordset object to search

– Key Value• the key value to use for searching

database actions

• DBSeek arguments

– Seek Option• DBSeekAfter – first record after key value• DBSeekAfterOrEqual – first record equal or after• DBSeekBefore – first record before key value• DBSeekBeforeOrEqual – first record equal or before• DBSeekFirstEqual – first record equal to key value• DBSeekLastEqual – last record equal to key value

database actions

• DBMove

– moves the cursor position in a recordset– EOF property set to True if you attempt to move past

last record– BOF property set to True if you attempts to move

before first record

database actions

• DBMove arguments

– Recordset• specifies the name of the recordset where the cursor

should be moved

– Move Option• DBMoveFirst, DBMoveLast, DBMoveNext or

DBMovePrevious

database actions

• DBBeginTrans

– used to create a new transaction– provider must support transactions– some providers support nested transactions– DDM data sources require journaling for the

database file

database actions

• DBBeginTrans arguments

– Connection• specifies that name of the connection for which the

transaction applies

database actions

• DBCommitTrans

– used to save changes in current transaction and then close transaction

– also starts a new transaction

database actions

• DBCommitTrans arguments

– Connection• specifies that name of the connection for which the

transaction applies

database actions

• DBRollbackTrans

– used to cancel any changes roll back a transaction– also begins a new transaction

database actions

• DBRollbackTrans arguments

– Connection• specifies that name of the connection for which the

transaction applies

centric 8 Training

Workshop 7

top related