LCFieldlist の Remove メソッド

このメソッドは、既存のフィールドをフィールドリストから削除します。関連付けられたメタデータの列は削除されません。結果セットの列の削除または追加がどのようにフェッチや挿入などのオペレーションメソッドに影響するかについては、「フィールドリストのマージとマッピング」を参照してください。

定義位置

LCFieldlist

構文

Call fldLstRecord .Remove (index)

パラメータ

パラメータ

説明

index

Long、1 以上。フィールドリストから削除するフィールドの、インデックスで指定された位置です。

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
    Forall fieldname In FldLst.Names
      If (text = "") Then text = fieldname Else text = text + ", " + fieldname
    End Forall
    Print "Before remove: " & text
    Call FldLst.Remove (1)
    text = ""
    Forall fieldname In FldLst.Names
      If (text = "") Then text = fieldname Else text = text + ", " + fieldname
    End Forall
    Print "After remove: " & text
  End If
End Sub

出力例

Before remove: ACCOUNTMANAGER, CONTACTNAME, COMPANYNAME, COMPANYADDRESS, COMPANYCITY, COMPANYSTATE, COMPANYPHONE
After remove: CONTACTNAME, COMPANYNAME, COMPANYADDRESS, COMPANYCITY, COMPANYSTATE, COMPANYPHONE