The IStatement Interface

 

interface IStatement: IResultSetStatement
{
  [propget, id(0x00000007), helpstring("Returns currently prepared statement.")]
   HRESULT _stdcall Statement([out, retval] BSTR * Value );
  [propput, id(0x00000007), helpstring("Prepares new statement for an execution.")]
   HRESULT _stdcall Statement([in] BSTR Value );

  [propget, id(0x00000005), helpstring("Parameters of prepared statement.")]
   HRESULT _stdcall Params([in] long index, [out, retval] IParamDataValue ** Value );

  [propget, id(0x00000003), helpstring("Count of prepared statement parameters")]
   HRESULT _stdcall ParamCount([out, retval] long * Value );

  [id(0x00000008), helpstring("Executes prepared statement.")]
   HRESULT _stdcall Execute( void );
}

The object implementing the IStatement interface allows an execution of SQL statement with/without taken of parameters. When an assignment to the Statement property is done, the current statement is cancelled and the new one is prepared. As well as an SQL statement may contain parameters; you can access them via the Params property. First index is zero and their count is determined by the ParamCount property. Once prepared, a statement can be executed as many times as desired. For more on parameters see the Parameters chapter.