Accessing SQL Server in a worker thread

  • Thread starter Thread starter Matthias Steinbart
  • Start date Start date
M

Matthias Steinbart

Hi there,

I'm trying to access an SQL Server through an SqlConnection within a worker
thread. This doesn't seem to work. If I call the Open() method, nothing
happens on the Server and no Exception is thrown. Is this by design or am I
missing something out?

thanks in advance.

Matthias
 
Code? I've used Asynchronous Delegates to so something similar, and it
works out just fine.

Thanks,
Michael C.
 
Hi Matthias:

I've done this many times with success. Perhaps you could post some
code for us to take a look at and give suggestions as to why it might
not be working for you.
 
Hey Scott,

thanks for your reply. I actually have been using a tiny framework that
makes the work with threads a lot easier. Obviously in this framework has
been a bug. It just took me ages to figure it out. Anyway, your reply is
greatly appreceated.

Matthias
 
Hi Michael,

as posted previously, the Bug actually was in a small framework I've been
using. Nevertheless I got curious about your solution using Asynchronous
Delegates. Could you please provide some cornerstones, so I can get the
picture. Thanks in advance.

Matthias
 
I just saw your message. I don't have any code handy on this laptop, but
all I did was run my SQL Command inside an Asynchronous Delegate with
Callback. It took a little while to figure out, but once done it's easy to
do it over and over. I gathered a lot of info. on Async Callbacks from
previous posts in this newsgroup, on the MS website and in the book C# and
the .NET Platform. Once I get on my regular computer I'll post some code
here for you... might not be for a couple of days though.

Thanks,
Michael C.
 
Back
Top