I want to make multiple mysql queries in the same time in C# -


i have code, when run select query works. when run insert query works. 2 queries can't work @ same time. don't know what's problem???! can me

public partial class signupfm : form     {         string str = @"server=localhost;database=bullivant_arabia_archive;userid=root;password='';";         mysqlconnection con = null;         mysqlcommand cmd = null;      public signupfm()     {         initializecomponent();     }      private void signupbt_click(object sender, eventargs e)     {          try         {             con = new mysqlconnection(str);             con.open();             if(checkuser(usernametb.text))             {                 if (password1tb.text == password2tb.text)                 {                     insertuser(this.usernametb.text, this.password1tb.text);                 }                 else                 {                     messagebox.show("you haven't enter same password twice");                 }             }             else             {                 messagebox.show("the user name exist, please enter one!");             }          }         catch (mysqlexception err)         {             console.writeline("error: " + err.tostring());         }                 {             if (con != null)             {                 con.close();             }         }     }      public void insertuser(string username, string password)     {         string userquery = @"insert login (username,password) values ('" + username + "' , '"                     + password + "')";         if (executeinsertquery(userquery))             messagebox.show("sign have been completed");         else             messagebox.show("sign couldn't completed");     }      bool checkuser (string username)     {         string query = @"select * login username = '" + username + "'";         if (executeselectquery(query))             return false;         else return true;     }      bool executeselectquery(string query)     {         cmd = new mysqlcommand(query, con);         if (cmd.executereader().read())             return true;         else return false;      }      bool executeinsertquery(string query)     {         cmd = new mysqlcommand(query, con);         if (cmd.executenonquery() == 1)             return true;         else return false;     } 

please share exact error getting. in opinion can't use same connection perform multiple queries. you'll fine using multiple connections, connection pooling works great mysql.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -