grip003
Well-known member
I am writing my own GUI front end for MySQL using C# and the ByteFX libraries. When the user wants to open a database, it asks for the server, port #, database, user name, and password to connect to MySQL. I have a test function that looks like the following:
If I put the correct informtion in the FIRST time, this function returns true. However, if I put in some incorrect information the first time (which returns false) but then correct the information and try it again, it returns false. Actually it returns false everytime after the initial wrong entry. The exception I get is
Access denied for user ...@...
Is this a MySQL issue or a programming issue? I cant seem to get this to work.
Code:
public bool testConnection(string server, string port,
string d_base, string user, string password)
{
string con_str = "Data Source=" + server +
";Port=" + port + ";Database=" + d_base +
";User ID=" + user + ";Password=" +
password + "";
MySqlConnection mysql_conn = new MySqlConnection(con_str);
try
{
mysql_conn.Open();
mysql_conn.Close();
return true;
}
catch (Exception)
{
mysql_conn.Dispose();
return false;
}
}
Access denied for user ...@...
Is this a MySQL issue or a programming issue? I cant seem to get this to work.