HRESULT Open( DBPROPSET *pPropSet = NULL, LONG* pRowsAffected = NULL, bool bBind = true );
HRESULT Open( const CSession& session, LPCTSTR szCommand = NULL, DBPROPSET *pPropSet = NULL, LONG* pRowsAffected = NULL, REFGUID guidCommand = DBGUID_DEFAULT, bool bBind = true );
Return Value
A standard HRESULT.
Parameters
pPropSet
[in/out] An array of DBPROPSET structures containing properties and values to be set. The properties specified in these structures must belong to the Rowset property group.
pRowsAffected
[in/out] A pointer to memory where the count of rows affected by a command is returned. If *pRowsAffected is NULL, no row count is returned. Otherwise, Open sets *pRowsAffected according to the following conditions:
If | Then |
The cParamSets element of pParams is greater than 1 | *pRowsAffected represents the total number of rows affected by all of the parameter sets specified in the execution. |
The number of affected rows is not available | *pRowsAffected is set to –1. |
The command does not update, delete, or insert rows | *pRowsAffected is undefined. |
bBind
[in] True if command is bound after being executed. Otherwise, false.
session
[in] The session in which to execute the command.
szCommand
[in] The command to execute. Can be NULL when using CAccessor, in which case the command will be retrieved from the value passed to the DEFINE_COMMAND macro. See ICommand::Execute in the OLE DB Programmer's Reference for details.
guidCommand
[in] A GUID that specifies the syntax and general rules for the provider to use in parsing the command text. See ICommandText::GetCommandText and ICommandText::SetCommandText in the OLE DB Programmer's Reference for details.
Remarks
Use the first version of this method when a command has already been created and you want to perform a single Prepare and multiple executions. The second version of the method takes a session, creates a command, and executes the command, binding any parameters as necessary.