I have a way that The amount of inclusion can be very high, so my program is freezing while inserting. That's why I call it After getting some insert, I get an exception That my connection has already been opened How do I do this here: My and My method is to actually enter values in the database: So how can I solve this mysterious problem? The problem is that you are closing your connection: You should call mysql is for the
loop in the database .
BackgroundWorker , although it is not working in schematic form ...
if (dbPos.conn open ()) {// contains a line , Then works fine because the data is present in DB DBipes. Checkout (Pries, Y); // It works for some inserts, // but after a couple it will tell me that my cone is already an open worker. RunWorkerAsync (); // Insert multiple rows} dbPos.connClose ();
Backgroundworker method:
zero worker _dovor (object sender, doWorkEventArgs e) {for (int i = 0; I & lt; chartList.Count; i ++) {switch (this.countChart (i)) {... work ... // insert rows}}}
using
(MySqlCommand cmd = new MySqlCommand (query, conn)) ... ... parameter .... cmd.ExecuteNonQuery (); }
If (dbPos.conn open ()) {// contains a row, works fine because the data db dbPos.checkOut (prijs, wie); // This * start * works, but does not block the worker. RunWorkerAsync (); // inserts multiple rows} // This is when the background work is still happening dbPos.connClose ();
dbPos.connOpen () and
connClose () in
BackgroundWorker S
DuvorX handler allows connections to remain open when this is done.
No comments:
Post a Comment