Friday, February 24, 2012

AutoFetch Option with Fast Forward Cursors with SQLOLEDB

Hi,

I am using the AutoFetch Option with Fast Forward Cursors with SQLOLEDB to access SQL Server 2005. This really works out but for the first I execute the query only.

But as I use parameterized statements, when I re-use the cursor, just re-binding new variables and re-executing it again, the AutoFetch does not work any more.

I noticed that thru the SQL Server Profiler. I see a sp_cursorfetch been called at the second time the cursor is re-executed.

Does anyone know how to work it out?

Thanks in advance.

Marcelo.

Hi Marcelo,

Are you using OLEDB interfaces directly or are you using SQLOLEDB through ADO? Also, can try to see if not calling Prepare on the command makes a difference in the behavior?

Thanks

Waseem

|||

Hi Waseem,

I am using OLEDB interfaces directly.

I prepare the parameterized statement only once and then re-execute it multiple times, binding different variables for each new execution. I noticed that the auto-fetch happens when I execute the statement the first time, but after that in the next execution I see with SQL Server Profiler a fetching call been done.

Regards,

Marcelo.

No comments:

Post a Comment