How to Specify Format Processing When Binding Columns

When you write code to bind columns during read, write, and update operations, you can also provide formatting instructions. For example, you can specify that you want to keep or override default formatting for specific columns.
To provide formatting instructions, you use the SASFORMAT structure (defined by SASExtensions.idl). The following code shows the SASFORMAT structure:
typedef enum
{
    SASFMT_FORMAT,
    SASFMT_INFORMAT
} SASFMTENUM;

typedef struct tagSASFORMAT
{
    SASFMTENUM wType;
    LPOLESTR pwszName;
    SHORT iLength;
    SHORT iDecimals;
} SASFORMAT;
The elements (members) of the SASFORMAT structure are described in the following table.
Elements (Members) of the SASFORMAT Structure
Element
Description
wType
Indicates whether a particular instance of a SASFORMAT structure applies to a column's format (SASFMT_FORMAT) or informat (SASFMT_INFORMAT).
pwszName
Pointer to the name (as a string) of the format or informat that should be used to override the column's default format.
iLength
Specifies the width to apply to the format or informat. If this value is nonzero, it will override the column's default format.
iDecimals
Specifies the number of significant decimal places that should be used when applying numeric formats or informats. If this value is nonzero, it will override the associated column's default format.
To perform the binding operation, you call the IAccessor::CreateAccessor method. For information about using the IAccessor::CreateAccessor method on rowsets returned by IOpenRowset::OpenRowset and ICommand::Execute, see the following topics: