I’m trying to connect to my mysql database but nothing seem to work out for me.
I’m going crazy, I’ve searched the internet for about 3 hours straight and didn’t find anything that is any use to me. Please, can anyone help me?
This is the code I have so far:
public bool tryLogin(string username, string password)
{
MySqlConnection con =
new MySqlConnection("Server=159.253.0.3;Database=dbname;Uid=username;Pwd=password;"); // Removed the login info.
MySqlCommand cmd =
new MySqlCommand("SELECT * FROM login WHERE user_name = '" + username + "' AND user_pass = '" + password +
"';");
cmd.Connection = con;
con.Open();
MySqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
if (reader.IsDBNull(0))
{
cmd.Connection.Close();
reader.Dispose();
cmd.Dispose();
return false;
}
else
{
cmd.Connection.Close();
reader.Dispose();
cmd.Dispose();
return true;
}
}
else
{
return false;
}
}
This is the error I keep getting:
Access denied for user
‘joeysft57_app’@’53569B33.cm-6-7c.dynamic.ziggo.nl’ (using password:
YES)
Looks like issue of permission (rights).. you can confirm it with connecting it with your local db.. if its working with your local db then surely its a issue of permission