bool CRBase::SetDataEx(ULONG nCol, void *pData, DBTYPE nDBType, ULONG nLen=OLEDB_STRING_END);
Return Value
true if successful; otherwise false.
Paramters
[in] nCol:
A column ordinal.
[in] pData:
A pointer to a data.
[in] nDBType:
A data type indicator.
[in] nLen:
The length of the buffer pData in bytes. For a fixed-length type data, it is ignored. However, it is required when a string data is not null-terminated or nDBType is DBTYPE_IUNKNOWN, DBTYPE_BYTES or DBTYPE_VARNUMERIC.
Remark
Sends a data in different formats into a provider with great flexibility by creating a temporary accessor no matter if the column is discarded. It can be also used to send a BLOB data as an in-memory data or a storage object into a data source. Here is the example.
CBulkRecord<COTable<CRBase>
>
BulkRecord;
BSTR
bstrEmpName=NULL;
VARIANT
vtAddress;
ISequentialStream
*pISequentialStream=NULL;
ULONG
nLenOfStream=0;
//Suppose that columns
4, 5, 6 have a name, an address and photo, respectively for an employee, and BulkRecord is
opened and moved to a record.
//Suppose that bstrEmpName, vtAddress,
pISequentialStream and nLenOfStream are already set properly.
BulkRecord.SetDataEx(4, &bstrEmpName,
DBTYPE_BSTR);
BulkRecord.SetDataEx(5, &vtAddress,
DBTYPE_VARIANT);
BulkRecord.SetDataEx(6,
&pISequentialStream, DBTYPE_IUNKNOWN, &nLenOfStream); //Attention:
provider releases a client created stream object after this call!
//must free the client allocated memories somewhere after these calls
if(bstrEmpName)
SysFreeString(bstrEmpName);
VariantClear(&vtAddress);
Additionally, see the examples FastAccess for how to use this function.