FieldSize Method

   

Returns the number of bytes used in the database (rather than in memory) of a Memo or Long Binary CdbField object in the Fields collection of a CdbRecordset object.

Syntax

LONG FieldSize(VOID);

Remarks

You can use FieldSize with the AppendChunk and GetChunk methods to manipulate large fields.

Because the size of a Long Binary or Memo field can exceed 64K, you should assign the value returned by FieldSize to a variable large enough to store a Long variable.

To determine the size of a Field object other than Memo and Long Binary types, use the Size property.

Note In an ODBCDirect workspace, the FieldSize method is not available in the following situations:

For example, Microsoft SQL Server version 4.21 does not support server-side cursors, so the FieldSize method is not available.

Usage

#include <afxole.h>
#include <dbdao.h>

LONG            length;
CdbField         fld;
CdbRecordset      rs;
...                  // Initialize as needed
fld = rs.Fields[0L];      // Get the first field
length = fld.FieldSize();   // Get the field size