LCFieldlist の GetName メソッド

このメソッドは、フィールドリスト内のフィールド名のコピーを取得します。

定義位置

LCFieldlist

構文

fieldName = fldList. GetName (index)

パラメータ

パラメータ

説明

index

Long、1 から fldLst.FieldCount の範囲。 フィールドリスト内のフィールドの位置です。

戻り値

説明

fieldName

String 型。フィールドの名前を返します。

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim connect As New LCConnection ("db2") 
  Dim FldLst As New LCFieldlist
  Dim field As LCField
  Dim i As Long
  ' this section assigns the appropriate properties to connect to DB2
  connect.Database = "Gold"
  connect.Userid = "JDoe"
  connect.Password = "xyzzy"
  connect.Metadata = "customer"
  connect.Connect
  ' now perform the catalog action - in this case for fields
  If (connect.Select (Nothing, 1, FldLst) = 0) Then
    Print "The customer table was not found."
  Else
    Print "There are " & FldLst.FieldCount & _
    " columns in the '" & connect.Metadata & "' table."
    Print "They are:"
    For i = 1 To FldLst.FieldCount
      Print Tab(4); FldLst.GetName (i)
    Next
  End If
End Sub

出力例

There are 7 columns in the 'customer' table.
They are:
   ACCOUNTMANAGER
   CONTACTNAME
   COMPANYNAME
   COMPANYADDRESS
   COMPANYCITY
   COMPANYSTATE
   COMPANYPHONE