Database actions In this presentation… –database actions –database connections –recordsets.
-
Upload
kellie-park -
Category
Documents
-
view
247 -
download
5
Transcript of Database actions In this presentation… –database actions –database connections –recordsets.
![Page 1: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/1.jpg)
database actions
• In this presentation…
– database actions– database connections– recordsets
![Page 2: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/2.jpg)
database actions
• database actions
– used to control database access– connecting, browsing, updating, deleting– searching support– transaction support
![Page 3: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/3.jpg)
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
![Page 4: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/4.jpg)
database actions
• database connection strings
– encode all parameters needed to connect to database
– dependant on provider– same as used in data control
![Page 5: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/5.jpg)
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
![Page 6: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/6.jpg)
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.
![Page 7: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/7.jpg)
database actions
• DBConnect
– establishes connection to remote data source– Connection String builder to create the string– user name and password prompted if not provided
![Page 8: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/8.jpg)
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
![Page 9: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/9.jpg)
database actions
• DBOpen
– used to open a recordset– if recordset is empty then EOF and BOF are both set
to True (additions allowed)
![Page 10: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/10.jpg)
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
![Page 11: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/11.jpg)
database actions
• DBOpen arguments
– Cursor Location• DBUseServer• DBUseClient• ignored for DDM
– Cursor Type• DBOpenDynamic• DBOpenForwardOnly• DBOpenKeyset• DBOpenStatic• DBOpenUnspecified
![Page 12: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/12.jpg)
database actions
• DBOpen arguments
– LockType• DBLockOptimistic• DBLockPessimistic• DBLockReadOnly• DBLockUnspecified
– CommandType• DBCmdFile• DBCmdStoredProc• DBCmdTable• DBCmdTableDirect• DBCmdText
![Page 13: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/13.jpg)
database actions
• DBClose
– used to close a recordset object– an error is produced if an update is outstanding– call DBUpdate or DBCancelUpdate first
![Page 14: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/14.jpg)
database actions
• DBClose arguments
– Recordset• specifies the recordset to close
![Page 15: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/15.jpg)
database actions
• DBDisconnect
– disconnects a data connection– closes any active recordsets– an error is generated if a transaction is in progress
![Page 16: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/16.jpg)
database actions
• DBDisconnect arguments
– Connection• specifies the connection to close
![Page 17: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/17.jpg)
database actions
• DBUpdate
– used to saves changes to the current record in a recordset
– cursor position in not changed
![Page 18: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/18.jpg)
database actions
• DBUpdate arguments
– Recordset• specifies the name of the recordset object to update
![Page 19: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/19.jpg)
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
![Page 20: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/20.jpg)
database actions
• DBCancelUpdate arguments
– Recordset• specifies the name of the recordset object for which
updates should be cancelled
![Page 21: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/21.jpg)
database actions
• DBAddNew
– used to create a new record in an updatable recordset
– changes are kept locally until DBUpdate or DBCancelUpdate is called
![Page 22: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/22.jpg)
database actions
• DBAddNew arguments
– Recordset• name of the recordset object to which the new record
should be added
![Page 23: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/23.jpg)
database actions
• DBDelete
– deletes the current record from a recordset– after deleting the record move to another record
![Page 24: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/24.jpg)
database actions
• DBDelete arguments
– Recordset• specifies the name of the recordset from which the
current record should be deleted
![Page 25: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/25.jpg)
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
![Page 26: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/26.jpg)
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
![Page 27: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/27.jpg)
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
![Page 28: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/28.jpg)
database actions
• DBSeek arguments
– Recordset• specifies the name of the recordset object to search
– Key Value• the key value to use for searching
![Page 29: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/29.jpg)
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
![Page 30: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/30.jpg)
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
![Page 31: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/31.jpg)
database actions
• DBMove arguments
– Recordset• specifies the name of the recordset where the cursor
should be moved
– Move Option• DBMoveFirst, DBMoveLast, DBMoveNext or
DBMovePrevious
![Page 32: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/32.jpg)
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
![Page 33: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/33.jpg)
database actions
• DBBeginTrans arguments
– Connection• specifies that name of the connection for which the
transaction applies
![Page 34: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/34.jpg)
database actions
• DBCommitTrans
– used to save changes in current transaction and then close transaction
– also starts a new transaction
![Page 35: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/35.jpg)
database actions
• DBCommitTrans arguments
– Connection• specifies that name of the connection for which the
transaction applies
![Page 36: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/36.jpg)
database actions
• DBRollbackTrans
– used to cancel any changes roll back a transaction– also begins a new transaction
![Page 37: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/37.jpg)
database actions
• DBRollbackTrans arguments
– Connection• specifies that name of the connection for which the
transaction applies
![Page 38: Database actions In this presentation… –database actions –database connections –recordsets.](https://reader031.fdocuments.in/reader031/viewer/2022020102/56649e705503460f94b6e6da/html5/thumbnails/38.jpg)
centric 8 Training
Workshop 7