1

I don't know what is happening to my MySql.Data why it is always encountering an error when I am opening a connection.

using MySql.Data.MySqlClient;

MySqlConnection myconn = new MySqlConnection();
myconn.ConnectionString = "server=192.168.0.xxx;port=3306;database=db_name;user id=root;password=pass123";
if (myconn.State == ConnectionState.Closed)
     myconn.Open();

then after myconn.Open(); is reach.

enter image description here

I am searching for that specific error here in stack but I don't see any answer.

PS: The code of MySqlConnection is working fine yesterday, but I don't know why that error appear a little while ago.

PPS : I tried the code of MySqlConnection in different projects and It is working fine too, but When it comes to my real project it is not working.

Imran Ali Khan
  • 8,469
  • 16
  • 52
  • 77
dotGitignore
  • 1,597
  • 2
  • 15
  • 34

1 Answers1

0

Lately, I have some modifications to my project

like:

  • adding and removing some Application Settings
  • Changing the .Net Framework version from 4.0 to 4.6.1 vice versa.

after of that many modification when the errors occurred. and I think because of that, the MySqlConnection was affected and not working.

Now I don't know why or how, but I solve my problem by changing the Assembly Information from 1.0.0.0 to 1.0.1.0. Changing the Assembly Information will cause the compiler to reevaluate the configuration and cause the application to refrain from creating and reading a new user.config file corresponding to the new version due to there being no user settings in the new version.

dotGitignore
  • 1,597
  • 2
  • 15
  • 34