Goran Bibic

Goran Bibic

  • 480
  • 2.9k
  • 200.3k

Conection string class mysql C#

Oct 2 2019 1:06 AM
I have more then 50000 records in table

Using connection sting in class
Time I spent now is more then 30 seconds, default value.
Need to setup conection life time or Conection time out
Need help

  1. string server = ConfigurationManager.AppSettings["server"].ToString();  
  2. string username = ConfigurationManager.AppSettings["username"].ToString();  
  3. string password = ConfigurationManager.AppSettings["password"].ToString();  
  4. string database = ConfigurationManager.AppSettings["database"].ToString();  
  5. // string conection = ConfigurationManager.AppSettings["connection time"].ToString();  
  6. conn = new MySqlConnection(@"server=" + server + ";userid=" + username + ";"  
  7.             + "password=" + password + ";database=" + database); 
OR

  1. conn = new MySqlConnection("Data Source='192.168.1.135';Port=3306;Database='prijavnica_app';UID='prijavnica';PWD='prijavnica'; Connect Timeout=120;"); 

Answers (3)