LCFieldlist の GetField メソッド

このメソッドは、フィールドリストの指定位置からフィールド参照を取得し、その値を変数に格納します。

定義位置

LCFieldlist

構文

Set field = fldLstRecord. GetField (index)

パラメータ

パラメータ

説明

index

Long、1 から fldLst.FieldCount の範囲。 返されるフィールドの位置です。

戻り値

説明

field

LCField。フィールドリストのインデックスで指定された位置にあるフィールドです。

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim connect As New LCConnection ("db2")
  Dim conFldLst As New LCFieldList
  Dim field As LCField
  ' this section assigns the appropriate properties to connect to DB2
  connect.Database = "Gold"
  connect.Userid = "JDoe"
  connect.Password = "xyzzy"
  connect.Metadata = "customer"
  ' connect to DB2
  connect.Connect
  ' now perform the catalog action - in this case for fields
  If (connect.Catalog (LCOBJECT_FIELD, conFldLst) = 0) Then
    Print "No tables were found."
  Else
    Set field =  conFldLst.GetField(1)
    Print "The columns in the '" & connect.Metadata & "' table include:"
    While (connect.Fetch (conFldLst) > 0)
      Print "     " & field.text(0)
    Wend
  End If
End Sub

出力例

The columns in the 'CUSTOMER' table include:
     ACCOUNTMANAGER
     CONTACTNAME
     COMPANYNAME
     COMPANYADDRESS
     COMPANYCITY
     COMPANYSTATE
     COMPANYPHONE