Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Command.Execute hangs forever

230 views
Skip to first unread message

Rob MacFadyen

unread,
Dec 8, 2009, 2:23:01 PM12/8/09
to
Hey all,

I've got a very odd case. I have a command object that occasionally will
"hang" forever.

Roughly speaking the code looks like:

dim cmd as ADODB.Command
cmd.CommandText = "blah blah"
set cmd.ActiveConnection = cn
cmd.Parameters.Append ... half dozen parameters ...
cmd.Execute ' <--- never ever completes or error's out

What is really odd about this is the doing a SQL trace/profile on the
database server does not show the command being sent to the server. It is
also odd that the particular bit of code is well used on a daily basis by
lots installations, and even many times by the installation where the problem
is occurring.

The windows event log (application, system, security) do not have any
applicable entries, the SQL Server error log is clean.

Is there any setting I can enable to get any sort of debug information out
of ADODB?

Any suggestions on stuff I should be looking at (I ran component checker on
the server and it's fine... mdac 2.8 sp2 on windows server 2003 sp2)?

Bob Barrows

unread,
Dec 8, 2009, 2:50:53 PM12/8/09
to

If you have On Error Resume Next in your code, comment it out so errors
are not masked.
--
HTH,
Bob Barrows


Bob Barrows

unread,
Dec 8, 2009, 3:49:16 PM12/8/09
to
Rob MacFadyen wrote:
> Hey all,
>
> I've got a very odd case. I have a command object that occasionally
> will "hang" forever.
>
> Roughly speaking the code looks like:
>
> dim cmd as ADODB.Command

Is this VB or VBA code?

> cmd.CommandText = "blah blah"
> set cmd.ActiveConnection = cn
> cmd.Parameters.Append ... half dozen parameters ...
> cmd.Execute ' <--- never ever completes or error's out

You're sure the code is reaching this point? You said it occurs
"occasionally" ... have you been able to see the behavior while stepping
through the code?

>
> What is really odd about this is the doing a SQL trace/profile on the
> database server does not show the command being sent to the server.

Can you see the connection being made (audit login event)?

> It is also odd that the particular bit of code is well used on a
> daily basis by lots installations, and even many times by the
> installation where the problem is occurring.
>
> The windows event log (application, system, security) do not have any
> applicable entries, the SQL Server error log is clean.
>
> Is there any setting I can enable to get any sort of debug
> information out of ADODB?

Nope.

> Any suggestions on stuff I should be looking at (I ran component
> checker on the server and it's fine... mdac 2.8 sp2 on windows server
> 2003 sp2)?

My last reply is probably not relevant. Instead, make sure the
CommandTimeout is set to a reasonable value

--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Rob MacFadyen

unread,
Dec 9, 2009, 4:03:02 AM12/9/09
to
Note that switching from the SQLOLEDB.1 provider to the SQLNCLI10 (SQL Native
Client) results in the command executing properly.

Bob Barrows

unread,
Dec 9, 2009, 7:21:36 AM12/9/09
to
Rob MacFadyen wrote:
> Note that switching from the SQLOLEDB.1 provider to the SQLNCLI10
> (SQL Native Client) results in the command executing properly.

Oh good! You have your solution!

Ronggang Yu

unread,
Feb 3, 2010, 10:37:01 AM2/3/10
to
Hi, Rob:

Do you have a simple repro? From your description, it seems like a
sqloledb bug. [switching to SNAC, your code works]. If you still have repro,
could you share with us? If we identify it is a product bug, we will fix it
on the latest O.S.

thanks,
ronggang.

e.t...@gmail.com

unread,
Aug 13, 2012, 6:21:52 AM8/13/12
to
Hi, I'm facing same problem on Windows 2008 R2 x64 where my application uses provider SQLOLEDB.1

Was there any progress on this case, to identify real culprit why SqlComamnds randomly hang?

Thanks
ET;
0 new messages