このメソッドでは、フィールドリスト内の 1 つのフィールドの情報を取り出します。繰り返し呼び出すことで、リスト内のフィールドを順に取り出すことができます。
LCFieldlist
flag = fldLst. List (position, destField, index, dataType, flags, fieldName)
パラメータ |
説明 |
---|---|
position |
Long。最初のフィールドを返すか、次のフィールドを返すかを示す定数です。以下のオプションがあります。 LCLIST_FIRST -- プロパティリスト内の最初のプロパティを返します。 LCLIST_NEXT -- 次のプロパティを返します。このコネクションに対する最初の呼び出しの場合は、最初のプロパティを返します。 |
destField |
LCField。出力 (オプション)。フィールドリスト内のフィールドです。 |
index |
Long。出力 (オプション)。フィールドリスト内の destField のインデックスです。LCFieldlist.Merge または LCFieldlist.MergeVirtual によって作成されたフィールドリストでは、番号が連続しないことがあります。 |
dataType |
Long。出力 (オプション)。destField のデータ型です。 |
flags |
Long。出力 (オプション)。destField のフィールドフラグです。フラグの詳細については、フィールドのクラスの説明を参照してください。 |
fieldName |
String 型。出力 (オプション)。フィールド名です。 注: この情報は、destField には保存されていません。
|
Option Public
Uselsx "*lsxlc"
Sub Initialize
Dim connect As New LCConnection ("db2")
Dim FldLst As New LCFieldlist
Dim pos As Long
Dim dtype As Long
Dim flags As Long
Dim fieldname As String
REM this section assigns the appropriate properties to connect to DB2
connect.Database = "Gold"
connect.Userid = "JDoe"
connect.Password = "xyzzy"
connect.Metadata = "customer"
REM connect to DB2
connect.Connect
REM select the records in the table (just to get the field descriptions)
If (connect.Select (Nothing, 1, FldLst) = 0) Then
Print "The customer table was not found."
Else
Print "The table description is:"
pos = LCLIST_FIRST
While (FldLst.List (pos, , , dtype, flags, fieldname) = True)
Print " " + fieldname + " is type #" +_
Cstr(dtype) + " with flags " + Hex(flags)
pos = LCLIST_NEXT
Wend
End If
End Sub
The table description is:
ACCOUNTMANAGER is type #1 with flags 2
CONTACTNAME is type #6 with flags 2
COMPANYNAME is type #6 with flags 2
COMPANYADDRESS is type #6 with flags 2
COMPANYCITY is type #6 with flags 2
COMPANYSTATE is type #6 with flags 2
COMPANYPHONE is type #6 with flags 2