Re: Freeze in ADODB.Recordset.Open

From: Val Mazur (group51a_at_hotmail.com)
Date: 05/21/04


Date: Thu, 20 May 2004 22:25:45 -0400

Hi Jonathan,

I do not see any reason for this. Since it does not happen on all PCs, could
be that MDAC installation is corrupted. Try to run Component Checker utility
, which ships with MDAC to see if it is OK

. Other suggestions:

1. Use Set statement to point to the opened connection. If you do not do
this, then recordset will open new connection each time, when you open it

Set .ActiveConnection = glbConn

2. Use OLEDB provider for SQL Server, rather than OLEDB for ODBC. It would
improve performance

-- 
Val Mazur
Microsoft MVP
"Jonathan Rynd" <q7a3ofvtcm502@atsneakemail.com.invalid> wrote in message 
news:Xns94EFB77257CE6jrr7hotmailcom@207.46.248.16...
> In VBA (Excel), connecting to MS SQL Server
>
> We have some code that creates an ADODB recordset.  We set
>
> Public glbConn As ADODB.Connection
>
>
>        Set glbConn = New ADODB.Connection
>        glbConn.Provider = "MSDASQL"
>        strConn = "DSN=" & kDBKMDSN & ";UID=" & kDBKMUser & ";PWD=" & _
>            kDBKMPass & ";"
>        glbConn.ConnectionString = strConn
>        glbConn.Open
>
>    Set mRS = New ADODB.Recordset
>    With mRS
>        .CursorType = adOpenStatic
>        .LockType = adLockReadOnly
>        .ActiveConnection = glbConn
>    End With
>
> and then in a loop we call
>
>    With mRS
>        .Source = strSQL
>        .Open
>    ' more stuff
>        .Close
>    End With
>
> The problem is that, on some computers but not others, the call to .Open
> hangs -- it takes forever.  The only way to recover is to break the
> program (ctrl-break or esc), click debug, and then press F5. That makes
> things start working again.  Without doing that it hangs forever.
>
> This hang does not take place when the code is stepped through using F8.
>
> - How can I diagnose this?  What other information would be helpful? 


Relevant Pages

  • Office 2003 Products hanging
    ... I recently installed Internet Explorer 7.0.5730.11. ... When I disconnect my dialup connection, ... Often, Outlook hangs as soon as it opens, although if it doesn't, then ... images, it notifies me to OK downloading the images in order to forward ...
    (microsoft.public.office.misc)
  • Re: i.mx31 OS hangs when doing Network load test.
    ... clock in the tray freezes and also the telnet connection can no longer be ... The i.mx31 board hangs after 15 minutes to some hours. ... you may check if the network adapter is requesting ... that request pending, preventing threads with a priority lower than ...
    (microsoft.public.windowsce.platbuilder)
  • Specifying options for Net::SFTP
    ... SFTP connection but they don't appear to be having any effect (The ... Remote version string: SSH-2.0-5.1.0.558 SSH Tectia Server ... And there it hangs. ...
    (comp.lang.perl.misc)
  • Re: hangs up on send/receive
    ... > connection to the internet hangs up immediately when OE ... > system file checker of Win98 and it found no problems with ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)