Database Development Technology and Engineering Practice Learning Notes

xiaoxiao2021-03-06  107

1. Connect the database control:

1. TDATABASE <==> BDE (AliasName and Drivername can only exist) TDATABASE Important Properties: AliasName Indicates the database BDE alias in the connection

DatabaseName indicates a database name used by a TDATABASE component

DRIVERNAME indicates the BDE drive name in the connection

TDATABASE Important: Close interrupt connection with database server

Commit Permanently saves the current transaction to update, insert or delete the data, and end current transactions

Rollback revokes the current transaction, ending transactions 2. Tadoconnection <==> ADO

Tadoconnection Important Properties:

ConnectionTIMEOUT Connection Database Time Limit

There are two cases: synchronous connection and asynchronous connections (the advantage of asynchronous connection is that the server is slower, the wait time is reduced)

Mode Sets Permissions (Read, Write, Disable, Allowed and other functions)

LoginPrompt settings login users and passwords

II. Access the database:

1. BDE mode:

Common properties of the data set control:

Does the Active control open

FILTERED filter switch

FilterOptions filter (case sensitive, whether to support unchecker)

Fields can directly access a piece of current record in the data set (p88)

FieldValues ​​is another way to access the data set currently record each field value

Recno can know that the current record pointer points to the sequence record in the data set, but also enables the pointer to the point

General method for data set control:

Open Close finds the way to turn off the data set, no parameters, can change the value of the ACTIVE attribute

Edit enters the editing state, no parameters

Applyupdates, CancelupDates, CommTUpdates, and RevertRecord submits the operation to the cache and finally submitted to the database, which can be revoked (the advantage is to reduce the operation of the database and the user can make multiple changes to a data set, as long as it is not submitted, everything Changes can be canceled

Findfirst, FindNext, Findlast, Findprior can find records that meet the filtering rules

First, Next, Last, PRIOR Movement Pointer

Lookup search meets a record of certain conditions, finds the value of returning the field, does not move the record pointer

Locate is the same as the LOOKUP, the different is not returned to the field, the mobile record pointer

Moveby moves pointer, similar to RecNo (absolute move), but it is relative

2. TTABLE Access Database

Main attribute: canmodify

DataSource

DefaultIndex is sorted by default

EXCLUSIVE is exclusive to a data sheet

EXISTS demonstrates whether the data table specified by the Tablename property has Indexdefs to get every predefined index of the table in the database specified by the TTable control DatabaseName property.

IndexfieldNames is used to specify the field name in the index table

MASTERSOURCE, MASTERFIELDS is used to specify one or more fields in the primary table to achieve the type of TableType table for the purpose of establishing a master-slave relationship between the database table.

DatabaseName Select Database

TABLENAME selection table

Its main method:

Addindex creates a new index

BatchMove Batch a set of records from the futures dataset type control to the data sheet connected to the TTable control

CloseIndexFile Close the DBase index file specified by the indexFileName property

CreateTable creation table

3. Use the TQuery to access the database it's main properties:

LOCAL can determine whether the local database is still a remote SQL server

ParamCheck is used to specify if the SQL property of the Query control is changed while the application is changed, and the query parameter list is automatically reconstructed.

PARAMS parameters, is some variables

4. ADO method

Tadocommand method:

Its main properties:

CommandObject Access ADO's Command object encapsulated in the Tadocommand control, generally does not recommend this property

CommandText Specifies the content of the command to be executed

CommandType defines the command type of TadoCommand control (P110 page)

Its main method:

Assign is copied to another tadocommand control

Cancel

One of the most important ways of Excute, there are three ways (p132)

Third. The field of a data set is either dynamic, or static, the two cannot exist at the same time.

转载请注明原文地址:https://www.9cbs.com/read-103989.html

New Post(0)