Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Asynchronous Stored Procedures

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-07-10 : 09:00:54
Glen writes "I have the following stored procedure:

-------------------------------------------------------------
CREATE PROCEDURE MyProc (@TestID Int = NULL)
AS
BEGIN

INSERT INTO MyLog Values (GetDate(),'TestEntry (' + convert(varchar,@TestID) + ')')

END
GO

-------------------------------------------------------------

I also have a VB app - I connect to my SQL Server using ADO and the sqloledb provider (ADO 2.6).

In the VB app I have the following code (cn is an open ADODB.Connection to my SQL Server):

-------------------------------------------------------------

For i = 0 to 100
SQL = SQL & "EXEC MyProc " & i & vbcrlf
Next

cn.Execute , , adAsyncExecute

-------------------------------------------------------------

I expected the procedure to create one hundred records in my database, but it didn't create any. When I remove the adAsyncExecute parameter then it works perfectly. Could you please tell me if it's possible to call the procedure multiple times Asynchronously?"

royv
Constraint Violating Yak Guru

455 Posts

Posted - 2002-07-10 : 10:12:59
When you are executing asynchronously, are you checking after the procedure has completed? You need to declare your connection object with events and then capture the event that will let you know when the connection has finished processing the request you sent.

*************************
Someone done told you wrong!
Go to Top of Page
   

- Advertisement -