Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1447

Should I use multiple connection and command objects for per thread? (no replies)

$
0
0
Hi, I'm a novice C# dev and I'm writing a database app the performs updates on two different tables and inserts on another two tables and each process is running on it's own separate thread. So I have two threads handling inserts on two different tables and two threads handling updates on two different tables. Each process is updating and inserting approximately 4 or 5 times per second so I don't close the connection until the complete session is over then I close the entire app. I wanted to know if I should be closing the connection after each insert and update even though I'm preforming these operations so frequently. 2nd, should I have each thread running on it's own connection and command object.

By the way I'm writing the app in C# 4.0 and the connector is 6.3. Also as of now I'm using one connection and command object for all four process. I keep getting an error message saying "There is already an open DataReader associated with this connection that must be closed first", that's why I'm asking if I should be using multiple connection and command objects.

Thanks

-Donld

Viewing all articles
Browse latest Browse all 1447


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>