Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Executing a stored procedure in the background
Message
 
To
10/02/2009 20:31:32
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Environment versions
SQL Server:
SQL Server 2005
Application:
Web
Miscellaneous
Thread ID:
01380765
Message ID:
01380858
Views:
43
>I have created a stored procedure which does a backup. From a VB.NET application, I can execute that stored procedure. However, this does not execute in background. So, the application freezes during that time. And, short after, I get a timeout expiration message. As this is a backup, is there a way to have this stored procedure to be started and my VB.NET application would continue immediately? Or, is my only way to execute that would then be from the Agent?

Can you just start it up on a new thread?
C# Version
public class MySample
{
   public void DoSomething()
   {
      // Code runs Stored Proc
   }
}

MySample sample = new MySample();
System.Threading.Thread thread = new System.Threading.Thread(sample.DoSomething);
thread.Start();

''VB Version

Public Class MySample
   Public Sub DoSomething()
        '' Code runs Stored Proc
   End Sub
End Class

Dim sample As MySample = New MySample()
Dim thread As System.Threading.Thread = New System.Threading.Thread(sample.DoSomething)
thread.Start()
I use a variation of this for some of the things I do where I fire off an event async:

http://www.rcs-solutions.com/blog/2007/10/19/SpeedingUpMyASPNETApp.aspx
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform