IRowsetFastLoad::InsertRow

Adds a row to the bulk-copy rowset.

HRESULT InsertRow(
HACCESSOR hAccessor,
void* pData);

Arguments

hAccessor [in]

Is the handle of the accessor defining the row data for bulk copy. The accessor referenced is a row accessor, binding consumer-owned memory containing data values.

pData [in]

Is a pointer to the consumer-owned memory containing data values.

Return Code

S_OK

The method succeeded. Any bound status values for all columns have value DBSTATUS_S_OK or DBSTATUS_S_NULL.

E_FAIL

An error occurred. Error information is available from the rowset’s error interfaces.

E_INVALIDARG

hAccessor was a NULL handle or pData was a NULL pointer.

E_OUTOFMEMORY

SQLOLEDB was unable to allocate sufficient memory to complete the request.

E_UNEXPECTED

The method was called on a bulk-copy rowset previously invalidated by IRowsetFastLoad::Commit.

DB_E_BADACCESSORHANDLE

The hAccessor provided by the consumer was invalid.

DB_E_BADACCESSORTYPE

The specified accessor was not a row accessor or did not specify consumer-owned memory.

Comments

An error converting consumer data to the SQL Server data type for a column causes an E_FAIL return from SQLOLEDB. Data can be transmitted to SQL Server on any InsertRow or only on Commit. Therefore, the consumer application can call InsertRow many times with erroneous data before it receives notice that an data type conversion error exists. Because Commit ensures that all data is correctly specified by the consumer, the consumer can use Commit intelligently to validate data as necessary.

SQLOLEDB bulk-copy rowsets are write-only. SQLOLEDB exposes no methods allowing consumer query of the rowset. To abort processing, the consumer can release its reference on IRowsetFastLoad without calling commit. There are no facilities for accessing a consumer-inserted row in the rowset and changing its values or removing it individually from the rowset.