First you have an empty catch block which makes no sense
Atleast this would have been better
catch (Exception ex)
{
MessageBox(ex.Message);// you would know if in case it failed
}
Now the problem seems to be
MySqlDataReader dr = cmd.ExecuteReader();
MessageBox.Show("OK");
con.Open(); <--- opening after executing the reader !
you should try putting the connection in a using block
using(MySqlConnection con = new MySqlConnection())
{
//your stuff in here
}
Another observation
cmd.Parameters.AddWithValue("@dateTimeNow", Convert.ToDateTime(DateTime.Now).ToString("yyyy-MM"))
DateTime.Now
is DateTime
no need to Convert
it again