Table A Paradox validity checks Validity check Meaning

Required field Every record in the table must have a value in this field. SQL tables can also use this validity check equivalent to NOT NULL . The values entered in this field must be equal to or greater than the minimum you specify here. The values entered in this field must be less than or equal to the maximum you specify here. The value you specify here is automatically entered in this field. You can replace it with another value. You specify a character string that acts as a template for...

Using indexes

The BDE uses indexes to keep track of the location of records in tables. This makes it easy to maintain a sorted order of a table and view like values together. When you create an index for a Paradox or dBASE table, Database Desktop creates a file that contains the indexed field's values and their locations. Database Desktop uses the index file to locate and sort the records in a table. Indexes work differently for Paradox, dBASE, and SQL tables. In Paradox tables, the primary index is called...

Formatting fields

Delphi provides built-in display and edit format routines and intelligent default formatting for TField components. These routines and formats require no action on the programmer's part. Default formatting conventions are based on settings in the Windows Control Panel. For example, using default Windows settings in the United States, a TFloatField column with the Currency property set to True sets the DisplayFormat property for the value 1234.56 to 1234.56, while the EditFormat is 1234.56. Only...

Using Goto functions

The GoToKey and GoToNearest methods enable an application to search a database table using a key. SetKey puts a table in search mode, more accurately referred to as SetKey state. In SetKey state, assignments indicate values for which to search for in indexed fields. GoToKey then moves the cursor to the first row in the table that matches those field values. For example, the following code could be used in the OnClick event of a button procedure TSearchDemo.SearchExactClick Sender TObject begin...

Figure TDBCheck Box component

Like the other data controls, TDBCheckBox is attached to a specific field in a dataset through its DataSource and DataField properties. Use the Caption property to display a label for the check box on your form. Set the ValueChecked property to a value the control should post to the database if the control is checked when the user moves to another record. By default, this value is set to True, but you can make it any alphanumeric value appropriate to your needs. You can also enter a...

TDBList Box

TDBListBox is functionally the same as TDBComboBox, but instead of a drop-down list, it displays a scrollable list of available choices. When the user selects a value at run time, the component is assigned that value. Unlike TDBComboBox, the user cannot type in an entry that is not in the list. Here is an example of how a TDBListBox component appears at run time. Figure 4.9 TDBListBox component While navigating through a dataset, a TDBListBox component displays values in the column by...

Defining secondary indexes

A secondary index is a field or group of fields other than the key field that can be used to sort the table or to link the table to other tables. Database Desktop enables you to create secondary indexes for Paradox tables. You can use a secondary index to see an alternate view order for a Paradox table. For example, to view the Customer table by City, while keeping the table's key order intact, you can use a secondary index on City to temporarily change the view order of the records. For...

Figure A TDBRadio Group component

For the current record, if the field associated with a radio group matches one of the strings in the Items or property, that radio button is selected. For example, if three strings, Red, Yellow, and Blue, are listed for Items, and the field for the current record contains the value Blue, then the third button in the group is selected. Note If the field does not match any strings in Items, a radio button may still be selected if the field matches a string in the Values property. If the field for...

Creating applicationspecific aliases

The TDatabase object enables you to create BDE aliases specific to an application. To name the alias, enter a name in the DatabaseName property. Any dataset components can then use the local alias by using the specified DatabaseName. To customize the parameters for a local alias, double-click on the TDatabase component. The Database Properties Editor opens Figure 6.3 Database Properties Editor Figure 6.3 Database Properties Editor This tool enables you to customize application-specific aliases...

Navigating and manipulating records with TDBNavigator

TDBNavigator provides users a simple control for navigating through records in a dataset, and for manipulating records. The navigator consists of a series of buttons that enable a user to scroll forward or backward through records one at a time, go to the first record, go to the last record, insert a new record, update an existing record, post data changes, cancel data changes, delete a record, and refresh record display. Next record First record Prior record TDBNavigator component Insert...

Building forms

The material in this section focuses on database issues. To learn about general application building with Delphi, see the User's Guide. The forms described here are the basis for a database application called MASTAPP, designed to meet the record-keeping needs of the fictitious Marine Adventures amp Sunken Treasures company MAST . MAST sells diving equipment and arranges diving expeditions. MASTAPP tracks information about customers, orders, inventory, and vendors. The tutorial starts with a...

Querying table data with QBE

A query is a question you ask about information in one or more tables. In addition to standard SQL queries, Database Desktop enables you to use a technique called query by example QBE to extract and manipulate data in tables. With QBE, you make the query image look like an example of the records you want to search for. The following figure shows a query that gives examples of the fields you want to see and a range of values within one of those fields , and the answer Database Desktop gives....

Building a sample database application Mastapp

This chapter is a tutorial and introduction to building Delphi database applications. Examples show how to perform database tasks using Delphi interactively and by programming in Object Pascal. In each example you build a single form, self-contained and independent of the others. You can save yourself some work by doing the examples in sequence. Several examples use the same basic form as a starting point. Note This material assumes you know how to use Delphi it tells you what to do to perform...

Table Dataaware list box and combo box controls Data controlDescription

TDBListBox Displays a list of items from which a user can update a specific column in the Combines a TDBEdit control with an attached list. The application user can update a specific column in the current data record by typing a value or by choosing a value from the drop-down list. Displays a list of items from which a user can update a column in the current data record. The list of items is looked up in a specific column in another dataset. Combines a TDBEdit control with a dropdown version of...

Formatting field values at design time

This example shows how to format a field value by setting the DisplayFormat property at 1 Use the Database Form Expert to build a single-table form that displays all the fields of CUSTOMER.DB. Specify a vertical layout and labels aligned left. For detailed instructions, see page 21. 2 Use the Object Inspector to change the form's Name property to EdCustForm, change the TTable component's Name property to Cust, and change the TTable component's Active property to True. In the form, notice the...

Displaying BLOB graphics with TDBImage

TDBImage is a data-aware component that displays bitmapped graphics contained in J BLOB data fields. It captures BLOB graphics images from a dataset, and stores them - internally in the Windows .DIB format. By default, TDBImage permits a user to edit a graphics image by cutting and pasting to and from the Clipboard, or if you supply an editing method. You can accomplish the same task programmatically by using the CutToClipboard, CopyToClipboard, and PasteFromClipboard methods. To make a...

Building a masterdetail form

The steps in this section show how to use the Database Form Expert to build a form containing two tables a master table and a detail table, linked one-to-many. This form is the basis for the CUSTORD.DFM form in MASTAPP. The master table is CUSTOMER.DB and the detail table is ORDERS.DB. You can access both tables using the MAST alias. The expert links these tables and creates components to display data for one customer at a time, and for each customer, to display many orders. When you use the...

Deploying BDE support

When you deploy a database application, you must ensure that the client platform has the correct version of the BDE installed. Delphi includes Redistributable BDE, with its own installation utility, that can you can redistribute with your applications. When you deploy an application, simply include a copy of the Redistributable BDE disk. The Delphi license agreement requires you to make all the files in Redistributable BDE available to your application users. This requirement enables users to...

TDBLookup Combo

The TDBLookupCombo component is similar to TDBComboBox, except that it derives its list of values dynamically from a second dataset at run time, and it can display multiple columns in its drop-down list. With this control, you can ensure that users enter valid values into forms by providing an interface from which they can choose values. Here is an example of how a TDBLookupCombo component appears at run time Figure 4.10 TDBLookupCombo component Figure 4.10 TDBLookupCombo component The lookup...

TDBLookup List

TDBLookupList is functionally the same as TDBLookupCombo, but instead of a drop-down list, it displays a scrollable list of the available choices. When the user selects one at run time, the component is assigned that value. Like TDBLookupCombo, the user cannot type in an entry that is not in the list. Here is an example of how a TDBLookupList component appears at run time While navigating through a dataset, a TDBLookupList component highlights the item in the list that corresponds to the value...

Displaying and editing BLOB text with TDBMemo

TDBMemo is a data-aware component similar to the Standard TMemo component that can display binary large object BLOB data. TDBMemo displays multi-line text, and permits a user to enter multi-line text as well. For example, you can use TDBMemo controls to display memo fields from dBASE and Paradox tables and text data contained in BLOB fields. By default, TDBMemo permits a user to edit memo text. To limit the number of characters users can enter into the database memo, use the MaxLength property....

Setting Tfield properties at design time

Because they are invisible, the only way to set the properties of TField components at design time is by using the Fields Editor. The following example shows how to set the properties of a TField component at design time. 1 Use the Database Form Expert to build a single-table form that displays all the fields of CUSTOMER.DB in a grid. For detailed instructions, see page 21. If you re working through these examples in sequence, you can use the form from the previous example and skip to step 5. 2...

Setting the update mode

The UpdateMode property of a dataset determines how Delphi will find records being updated in a SQL database. This property is important in a multi-user environment when users may retrieve the same records and make conflicting changes to them. When a user posts an update, Delphi uses the original values in the record to find the record in the database. This approach is similar to an optimistic locking scheme. UpdateMode specifies which columns Delphi uses to find the record. In SQL terms,...

Symbols

plus sign in property lists 103 operator 177 operator 177 colon in SQL statements 117, 176 lt operator 177 lt gt operator 177 operator 177 gt operator 177 question mark in SQL statements 176 II operator 177 - minus sign in property lists 104 apostrophe , naming conventions 175, 176 abandoning changes 64, 101, 107 Abort procedure 68 AbortOnKeyViol property 92 AbortOnProblem property 92 accessing data 79, 89, 100, 115, 116 at run time 87-88 field values 30, 32 optimizing access 119 remote...