c# - Getting Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool -


The problem I am experiencing over this period is that I am using mysql database more often and working on windows application I am I have also tried to use pen, but faced the same situation

  Public Bull VerifyStock (string serialnumber) {con = new MySqlConnection (connstring); String readData = "Choose * from Fn_Inventory * where ModelNumber = '" + serialnumber + "'"; CMD = new MySQL Commands (Reading Data, Con); Cmd.Parameters.AddWithValue ("Model Number", SerialNumber); Con.Open (); Dr = cmd.ExecuteReader (); If (Dr. HSRO) {// while (Dr. Reid ()) (Dr. Reid ()) {decimal invquntity = convert toDecimal (dr ["available amount"]. ToString ()); Decimal volume = convert toDecimal (txtQuantity.Text); Decimal sinvquntity = invquntity - volume; If (sinvquntity> = 0) {return false; } And {return true; }} And {return false; }} And {return false; } Con.Close (); }    

Increasing the size of the connection pool and timing will be quicker.

and close the closed connection and external conditions. Use to try to catch at the end and block this code to Finally add it to the block so that it can always be executed.

  if (con.state = = open connection.state) {con.Close (); }    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -