Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АвтомобилиАстрономияБиологияГеографияДом и садДругие языкиДругоеИнформатика
ИсторияКультураЛитератураЛогикаМатематикаМедицинаМеталлургияМеханика
ОбразованиеОхрана трудаПедагогикаПолитикаПравоПсихологияРелигияРиторика
СоциологияСпортСтроительствоТехнологияТуризмФизикаФилософияФинансы
ХимияЧерчениеЭкологияЭкономикаЭлектроника

Searching a table

Читайте также:
  1. A) Complete the table with personal and professional abilities. Use the list below. Give the reasons.
  2. An The reacting Unstable The Products of
  3. Annex 7 TRANSLITERATION TABLE FOR GREEK
  4. ARW2 Summary table of literature sources
  5. B) Complete the following table of statistics. Fill in the missing percentage using figures from the box.
  6. B. Fill in the table with the words formed form the word given (where possible).
  7. Be recovering, proves fatal. Notable phases of a remarkable career. 1 страница

Lecture 13. Using TTable component

 

TTable is one of the most important database component classes. Along with the otherdataset component class, TQuery, it enables an application to access a database table. This lecture describes the most important properties that are unique to TTable.

 

Specifying the database table

TableName specifies the name of the database table to which the TTable component islinked. You can set this property at design time through the Object Inspector.

The DatabaseName property specifies where Delphi will look for the specified database table. It can be a BDE alias, an explicit specification, or the DatabaseName defined by any TDatabase component in the application. For Paradox and dBASE tables, an explicitspecification is a directory path; for SQL tables, it is a directory path and database name.

Instead of an actual directory path or database name, DatabaseName can also be a BDE alias. The advantage of this is that you can change the data source for an entire application by simply changing the alias definition in the BDE Configuration Utility.

 

Note Neither of these properties can be changed when a table is open—that is, when the table’s Active property is set to a value of True.

 

The TableType property

The TableType property specifies the type of the underlying database table. This property is not used for SQL tables.

If TableType is set to Default, the table’s file-name extension determines the table type:

• Extension of.DB or no file-name extension: Paradox table

• Extension of.DBF: dBASE table

• Extension of.TXT: ASCII table

If the value of TableType is not Default, then the table will always be of the specified TableType, regardless of file-name extension.

 

Searching a table

TTable has a number of functions that will search for values in a database table:

• Goto functions

• Find functions

The easiest way to search for values is with the Find functions, FindKey and FindNearest. These two functions combine the functionality of the basic Goto functions, SetKey, GoToKey, and GoToNearest, which are described first.

In dBASE and Paradox tables, these functions can search only on index fields. In SQL tables, they can search on any fields, if the field name is specified in the IndexFieldNames property of the TTable. For more information, see “Indexes” on page 74.

To search a dBASE or Paradox table for a value in a non-index field, use SQL SELECT syntax with a TQuery component. For more information on using SQL and TQuery components, see Chapter 5, “Using SQL in applications.”

 


Дата добавления: 2015-10-23; просмотров: 110 | Нарушение авторских прав


Читайте в этой же книге: Using TFields and the Fields Editor | Defining a calculated field | KRS 0000234069, Regon 300055546, NIP 6080024482 |
<== предыдущая страница | следующая страница ==>
Lecture 9. Using Data Controls| Using TDataSource events

mybiblioteka.su - 2015-2024 год. (0.006 сек.)