LCFieldlist の SetName メソッド

このメソッドは、フィールドリスト内のフィールド名を変更します。

定義位置

LCFieldlist

構文

Call fldLstRecord. SetName (index, fieldName)

パラメータ

パラメータ

説明

index

Long、1 以上。インデックスで指定されたフィールドの位置です。

fieldName

String 型。このフィールドに新しく付けられる名前です。

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim connect As New LCConnection ("db2") 
  Dim FldLst As New LCFieldlist
  Dim field As LCField
  Dim text 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 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
    REM fetch the field names
    Call FldLst.SetName (1, "pinky")
    text = ""
    Forall fieldname In FldLst.Names
      If (text = "") Then text = fieldname Else text = text + ", " + fieldname
    End Forall
    Print "The new list of columns in the '" & connect.Metadata & "' table are: " & text
  End If
End Sub

出力例

The new list of columns in the 'customer' table are: 
pinky, CONTACTNAME, COMPANYNAME, COMPANYADDRESS, COMPANYCITY, COMPANYSTATE, COMPANYPHONE