GetField Method for LCFieldlist
This method gets a field reference from a specified position in a fieldlist and places its value into a variable.
Defined In
LCFieldlist
Syntax
Set field = fldLstRecord. GetField (index)
Parameters
Parameter |
Description |
---|---|
index |
Long, in the range 1 to fldLst.FieldCount. Position of the field to be returned. |
Return Values
Value |
Description |
---|---|
field |
LCField. The field at the index position in the fieldlist. |
Example
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
Example Output
The columns in the 'CUSTOMER' table include:
ACCOUNTMANAGER
CONTACTNAME
COMPANYNAME
COMPANYADDRESS
COMPANYCITY
COMPANYSTATE
COMPANYPHONE