Not a direct answer but some tips
Rather than this
if (MySqlConnection.State != ConnectionState.Closed)
{
MySqlConnection.Close();
}
You should be making use of using block
using(SqlConnection conn = new SqlConnection(...))
{
}
This will ensure the connection object closed and disposed of when the block is exited, even if an exception occurs.
It is more performant to use
txt_cus_code.Length == 0
rather then this
txt_cus_code.Text == ""