DB2Connection trouble within a BackgroundWorker

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • seraieis
    New Member
    • Apr 2008
    • 60

    DB2Connection trouble within a BackgroundWorker

    I have a program that, within a BackgroundWorke r, runs a small SELECT query from a DB2 Database. The basic form looks like this:

    Code:
    BackgroundWorkerFunction(BackgroundWorker b)
      - open DB2Connection
      - run query
      - close DB2Connection
      - RaiseEvent QueryDone
    Now, I've been very careful not to put a DB2Connection within a loop, because I don't want to open multiple connections. However, when we monitor the database, we are seeing multiple connections (per machine) when we would expect to see only one.

    Can the BackgroundWorke r act like a loop, so that there are multiple connections opening? I always assumed that the point of the BackgroundWorke r class was for multithreading, but in this instance it's looking more like a loop.

    Am I making sense, or am I just going crazy?

    Thanks in advance!
Working...