Stored procedure and threading help.

T

trialproduct2004

Hi all,

i am having application which is using stored procedure written in sql
server.
I want to develop multithreaded applicaton.
The store procedure is returing list of rows of table.
what i want to ask is, if i tried to call same stored procedure in
different thread , is it possible or it will created problem in
multithreaded application.

If yes how to get rows returing from stored procedure.

Any help will be appreciated.
thanks in advance.
 
G

Guest

It should not cause a problem as long as you are not trying to relate the
different data pulls. If you are doing this

Spawn thread
Call for user information

Spawn another thread
Call for user orders

Spawn another thread
Call for user order details

When all are returned, relate them

That could be problematic as there is no locking mechanism across all calls,
which means data could be updated rendering user or orderinformation invalid
when you call for details.

If you are pulling data asynch that is not related, you should not have any
problems. Looking at your post, it appears you are simply calling the same
stored procedure on multiple threads (for multiple users?).

Short answer: As long as the threads are not talking to each other (or
aggregating for the main app thread to relate data), you should not have any
problems.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


There is no difference at all, just create the thread with method you use
to execute the SP, note that you cannot pass a parameter ( but there r ways
of doing it ) then this method will become the new thread.
Do your stuff and if you store the readed data in a instance variable it
will be available from the originator thread. just notice that you need to
control that nobody access the collection at the same time you are
populating it.

There is nothing really difficult about it.

cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top