GetName Method for LCFieldlist
This method obtains a copy of the name of a field within a fieldlist.
Defined In
LCFieldlist
Syntax
fieldName = fldList. GetName (index)
Parameters
Parameter |
Description |
---|---|
index |
Long, in the range 1 to fldLst.FieldCount. The position of the field in the fieldlist. |
Return Values
Value |
Description |
---|---|
fieldName |
String. The name of the field. |
Example
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
Example Output
There are 7 columns in the 'customer' table.
They are:
ACCOUNTMANAGER
CONTACTNAME
COMPANYNAME
COMPANYADDRESS
COMPANYCITY
COMPANYSTATE
COMPANYPHONE