Data.DB.TDataSet.FieldByNumber

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

function FieldByNumber(FieldNo: Integer): TField; inline;

C++

TField* __fastcall FieldByNumber(int FieldNo);

プロパティ

種類 可視性 ソース ユニット
function protected
Data.DB.pas
Data.DB.hpp
Data.DB TDataSet


説明

テーブルやクエリ内の列の位置順を基に、フィールドを検索します。

FieldByNumber を呼び出すと、ベースとなるテーブルやクエリ内の、フィールドの列の位置順によって指定された、フィールドに関する情報を取得することができます。FieldNo は、ベースとなるテーブルの、既存フィールドの列の位置順です。FieldByNumber は、指定されたフィールドを表す TField コンポーネントを返します。指定されたフィールドが存在しなかった場合、FieldByNumbernil(Delphi の場合)および NULL(C++ の場合)を返します。

アプリケーションは、FieldByNumber によって返されたフィールドの、特定のプロパティまたはメソッドに、直接アクセスすることができます。たとえば、次の文は、指定されたフィールドが計算フィールドかどうかを確認しています:

if Customers.FieldByNumber('FullName').Calculated then
MessageDlg(Format('%s is a calculated field. ', ['FullName']), mtInformation, [mbOK], 0);
if (Customers->FieldByNumber("FullName")->Calculated)
Application.ShowMessage("This is a calculated field", "FullName", MB_OK);


関連項目