Error while connecting Mysql using .NET. How to resolve?

Asked

Viewed 249 times

2

Exception when connecting to the bank:

Ispasswordexpired: 'Conn.Ispasswordexpired' threw an Exception of type 'System.Nullreferenceexception'

Serverthread: 'Conn.Serverthread' threw an Exception of type 'System.Nullreferenceexception'

Serverversion: 'Conn.Serverversion' threw an Exception of type 'System.Nullreferenceexception'

Exception when trying to open the connection:

"The type initializer for 'System.Transactions.Diagnostics.Diagnostictrace' threw an Exception."

public static MySqlConnection Conexao()
{
   string strConexao = "Server=ip_do servidor_de bd;Port=3306;Database=meubanco;Uid=usuario;Pwd=senha;";
   MySqlConnection conn = new MySqlConnection();
   conn = new MySqlConnection(strConexao);

   conn.Open();

   return conn;
}
  • It has two errors cited in your question, but the first does not seem to match the snipet posted. It can improve the question by kindness?

  • Regarding the first error: Checks if your mysql password has not expired, default is the password last 1 year(Except if you changed the setting).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.