Re: ATL OLE DB Consumer Code problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On Dec 12 2007, 1:24 pm, Olivier MATROT <olivier.mat...@xxxxxxxxxxxxx>
wrote:
I'm using ATL OLE DB Consumer code, specifically a CCommand<TAccessor,
TRowset,TMulitple> based class. The accessor is of type CAccessor, the rowset
is of type CRowset and there is a single rowset returned by the query. The
query used is either a simple SQL SELECT Statement or a stored procedure call.

The same behavior is observed with either SQL Server OLE DB Provider or SQL
Native Client provider.

Sometimes, after creating the command on the session and excuting it
(CCommand::Open(...)), the return value is E_FAIL and there is no error
associated.

After digging in the code, it appears that ICommand::Execute returns S_OK
but there is no rowset interface returned (GetInterface() == NULL). MSDN
documentation is not talking about this behavior. You could see the code in
the function CCommand<>::ExecuteAndBind(...) in atldbcli.h. Bind() is called
and returns E_FAIL.

Any help appreciated.

I'm seeing this issue also... spend the last couple of days on it.

The error seems to be that CMultipleResults is broken. At line 6796
of atldbcli.h you find within GetNextResult:
HRESULT hr = GetMultiplePtr()->GetResult(NULL, 0, GetIID(),
pulRowsAffected, (IUnknown**)GetInterfacePtr());
if (FAILED(hr))
return hr;

Which *should* initialise the result set pointer. This alas does not
work at all. pulRowsAffected is set to -1, hr returns S_OK, but the
interface pointer is not initialised. This causes later code within
oledb to assert.

The workaround seems to be to not use CMultipleResults (which is
virtually completely undocumented - a single page on MSDN giving a
short summary of what it's for that that's it, so I guess it's rarely
used).

Tony
.



Relevant Pages

  • Re: ATL OLE DB Consumer Code problem
    ... The accessor is of type CAccessor, ... is of type CRowset and there is a single rowset returned by the query. ... The same behavior is observed with either SQL Server OLE DB Provider or SQL ...
    (microsoft.public.data.oledb)
  • ATL OLE DB Consumer Code problem
    ... I'm using ATL OLE DB Consumer code, specifically a CCommand<TAccessor, ... The accessor is of type CAccessor, ... is of type CRowset and there is a single rowset returned by the query. ... The same behavior is observed with either SQL Server OLE DB Provider or SQL ...
    (microsoft.public.data.oledb)
  • Re: File Names In Table
    ... So if I have your situation correct you need to pick up a rowset from a SQL ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. ... There is no reference to the task that has the sql> string in it. ...
    (microsoft.public.sqlserver.dts)
  • Re: dr.Read()
    ... When you execute any query that does not return ... a rowset, the DataReader returns as "closed". ... William (Bill) Vaughn ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: DTS - Global Rowset - Use in Execute SQL Task
    ... if it is then you could use a linked server. ... How to loop through a global variable Rowset ... Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. ... > Now I create a "Transform Data Task" to move the data based on the global> Variable. ...
    (microsoft.public.sqlserver.dts)