App hangs using ADO to execute a SQL Stored Procedure



I'm using an Access Database and ADO to call a SQL Stored Procedure to
update about 2 to 4 records in a SQL table. When I call the .execute
method of the ADO Command object, the app hangs until the timeout
period expires. The SQL Server is also unresponsive to ALL subsequent
requests until my code is stopped (there's a blocking process on the
SQL Server until I end my code.) The update is NOT successful. There
are no errors in the SQL Server log.

If I execute the stored procedure in Query Analyzer, it runs fine and
produces the correct result in a fraction of a second. I have double
checked my parameter declaration to ensure the Table/SP & ADO code all
declare the parameter using the same type consistently. I have debugged
the parameter value being sent, deleted and re-created the stored
procedure, tried various connection strings (including a system DSN
that is setup and working otherwise), and varying ways of declaring /
creating the ADO objects and assigning their values. Currently, VBA
references ADO 2.7, but I've tried 2.5 and 2.6 also.

Everything I have tried produces the same result. However, I have
noticed that if I evaluate the value of the .commandtext property in
debug mode, I see that it is not exactly as assigned.

My assignment is: .CommandText = "Upd_BH_DLFlag"
The value when viewed in debug is: "{call Upd_BH_DLFlag(?)}"

That drew my attention and could be the issue or it may be an internal
translation that is OK, I guess.)

If anyone has any ideas to offer, I would appreciate them greatly. All
of the code involved is posted below.

**************************************************************
Here's the SP that gets called:
**************************************************************
CREATE PROCEDURE Upd_BH_DLFlag
( @SystemID int )
AS
UPDATE Batches SET DownloadFlag = 2 WHERE OrderID = (SELECT OrderID
FROM Batches WHERE SystemID = @SystemID)
**************************************************************

**************************************************************
Here's my Current conn string (I've tried many others too)
(Some values have been replaced/masked)
**************************************************************
Provider=sqloledb;Network Library=DBMSSOCN;Data
Source=10.xx.xx.xx,1433;Initial Catalog=dbPA_prod;User
ID=***;Password=***;
**************************************************************

**************************************************************
Here's the code:
**************************************************************
Public Sub UpdateBHDownloadFlag(lSystemID As Long)
Dim oCon As New ADODB.Connection
Dim oCmd As New ADODB.Command
Dim oParam As New ADODB.Parameter

'Open the connection
oCon.Open sSQLConnString

With oCmd
.ActiveConnection = oCon
.CommandTimeout = 10
.CommandType = adCmdStoredProc
.CommandText = "Upd_BH_DLFlag"

' Create the parameter
Set oParam = .CreateParameter("@SystemID", adInteger, adParamInput,
, lSystemID)

' Add it to the collection
.Parameters.Append oParam

' Execute the command
.Execute '(the code hangs right here)

End With

'Close the connection
oCon.Close

'Cleanup
Set oParam = Nothing
Set oCmd = Nothing
Set oCon = Nothing

End Sub
**************************************************************

Thanks in advance for taking the time to study this and submitting any
ideas you may have!

Dan

.



Relevant Pages

  • Re: How can a recordset returned by a sproc be updated?
    ... > To my surprise, the application is also able, via ADO, to update the ... > Watching whats going on with SQL profiler, ... Can ADO somehow get at the ... I tried making a view and having the stored procedure select ...
    (microsoft.public.sqlserver.programming)
  • Re: How can a recordset returned by a sproc be updated?
    ... While I run the test on my box I haven't seen update statement as OP said. ... > SQL Server MVP ... >> ADO. ... I tried making a view and having the stored procedure select ...
    (microsoft.public.sqlserver.programming)
  • Re: How can a recordset returned by a sproc be updated?
    ... With the resultset metadata is returned to the client that allows ADO and ... SQL Server MVP ... > ADO. ... I tried making a view and having the stored procedure select ...
    (microsoft.public.sqlserver.programming)
  • Could not find installable ISAM
    ... Within a stored procedure that is scheduled through SQL ... The server is using mixed mode security. ... It seems like somehow ADO on the server just ...
    (microsoft.public.sqlserver.odbc)
  • Re: Views vs Stored Procedures, whats the difference?
    ... I hope you are not suggesting you embed SQL queries into the application? ... A stored procedure logic will be exactly as fast as the algorithm you ... I understant that SQL Server supports hints. ... implementations (nestedloop, merge, hash, ..) on decent sized tables, then ...
    (comp.databases.ms-sqlserver)