sx_FieldName

<< Click to Display Table of Contents >>

Navigation:  Apollo API Listing >

sx_FieldName

VB Declaration

Declare Function sx_FieldName Lib "Apollo9.dll"

(ByVal uiFieldNum As Integer)

As String

C Declaration

LONG FAR PASCAL sx_FieldName

(USHORT uiFieldNum);

Description

Extracts the name of the nth field. The first field is number 1.

Parameters

uiFieldNum: The field index number (relative to 1).

Return Value

The field name is returned as a string. If uiFieldNum is invalid, a NULL string is returned.

VB Example

Sub Form_Load ()

Static FieldTabs(3) As Integer

Dim i As Integer

 

' Fill list box List1 with field info

FieldTabs(1) = 48

FieldTabs(2) = 65

FieldTabs(3) = 84

k& = SendDlgItemMessage(sxdbinfo.hWnd, GetDlgCtrlID(List1.hWnd),

Ä (LB_SETTABSTOPS, 3, FieldTabs(1))

For i = 1 To sx_FieldCount()

ListName$ = sx_FieldName(i)

ListStr$ = ListName$ + Chr(9) + sx_FieldType(ListName$) +

Ä (Chr(9) + Format$(sx_FieldWidth(ListName$), "000") +

Ä (Chr(9) + Format$(sx_FieldDecimals(ListName$),"00")

List1.AddItem ListStr$, (i - 1)

Next i

End Sub

C Example

// fill list box with field data

uiFieldCount = sx_FieldCount();

 

// set list box items

for (i = 0; i < (SHORT) uiFieldCount; i++)

{

lstrcpy((LPSTR) caFieldName, (LPSTR) sx_FieldName(i + 1));

lstrcpy((LPSTR) caFieldType, (LPSTR) sx_FieldType(caFieldName));

itoa(sx_FieldWidth(caFieldName), caFieldLen, 10);

itoa(sx_FieldDecimals(caFieldName), caFieldDec, 10);

 

// non-memos only

if (caFieldType[0] != 'M')

{

_fmemset(caString, 0, (size_t) sizeof(caString));

 

lstrcpy(caString, caFieldName);

caString[lstrlen(caString)] = '\t';

lstrcat(caString, caFieldType);

caString[lstrlen(caString)] = '\t';

lstrcat(caString, caFieldLen);

caString[lstrlen(caString)] = '\t';

lstrcat(caString, caFieldDec);

SendDlgItemMessage(hdlg, ID_L1,  

LB_ADDSTRING, NULL, (LPSTR) caString);

}

}

See Also

sx_FieldCount, sx_FieldDecimals, sx_FieldNum, sx_FieldOffset, sx_FieldType, sx_FieldWidth