Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database actions In this presentation… –database actions –database connections –recordsets.

Similar presentations


Presentation on theme: "Database actions In this presentation… –database actions –database connections –recordsets."— Presentation transcript:

1 database actions In this presentation… –database actions –database connections –recordsets

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

3 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

4 database actions database connection strings –encode all parameters needed to connect to database –dependant on provider –same as used in data control

5 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

6 database actions Actions DBAddNew 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.

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

8 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

9 database actions DBOpen –used to open a recordset –if recordset is empty then EOF and BOF are both set to True (additions allowed)

10 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

11 database actions DBOpen arguments –Cursor Location DBUseServer DBUseClient ignored for DDM –Cursor Type DBOpenDynamic DBOpenForwardOnly DBOpenKeyset DBOpenStatic DBOpenUnspecified

12 database actions DBOpen arguments –LockType DBLockOptimistic DBLockPessimistic DBLockReadOnly DBLockUnspecified –CommandType DBCmdFile DBCmdStoredProc DBCmdTable DBCmdTableDirect DBCmdText

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

14 database actions DBClose arguments –Recordset specifies the recordset to close

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

16 database actions DBDisconnect arguments –Connection specifies the connection to close

17 database actions DBUpdate –used to saves changes to the current record in a recordset –cursor position in not changed

18 database actions DBUpdate arguments –Recordset specifies the name of the recordset object to update

19 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

20 database actions DBCancelUpdate arguments –Recordset specifies the name of the recordset object for which updates should be cancelled

21 database actions DBAddNew –used to create a new record in an updatable recordset –changes are kept locally until DBUpdate or DBCancelUpdate is called

22 database actions DBAddNew arguments –Recordset name of the recordset object to which the new record should be added

23 database actions DBDelete –deletes the current record from a recordset –after deleting the record move to another record

24 database actions DBDelete arguments –Recordset specifies the name of the recordset from which the current record should be deleted

25 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

26 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

27 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

28 database actions DBSeek arguments –Recordset specifies the name of the recordset object to search –Key Value the key value to use for searching

29 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

30 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

31 database actions DBMove arguments –Recordset specifies the name of the recordset where the cursor should be moved –Move Option DBMoveFirst, DBMoveLast, DBMoveNext or DBMovePrevious

32 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

33 database actions DBBeginTrans arguments –Connection specifies that name of the connection for which the transaction applies

34 database actions DBCommitTrans –used to save changes in current transaction and then close transaction –also starts a new transaction

35 database actions DBCommitTrans arguments –Connection specifies that name of the connection for which the transaction applies

36 database actions DBRollbackTrans –used to cancel any changes roll back a transaction –also begins a new transaction

37 database actions DBRollbackTrans arguments –Connection specifies that name of the connection for which the transaction applies

38 centric 8 Training Workshop 7


Download ppt "Database actions In this presentation… –database actions –database connections –recordsets."

Similar presentations


Ads by Google