title: c# and MySQL select string from db and utf-8 table
body: <p>that the code i use to create Connection with the datebase</p>
  
  <pre><code>private static string MySqlUsername, MySqlPassword, MySqlDatabase, MySqlHost;
          private static string ConnectionString;
          public static void CreateConnection(string user, string password, string database, string host)
          {
              MySqlUsername = user;
              MySqlHost = host;
              MySqlPassword = password;
              MySqlDatabase = database;
              ConnectionString = "Server=" + MySqlHost + ";Database='" + MySqlDatabase + "';Username='" + MySqlUsername + "';Password='" + MySqlPassword + "';Pooling=true; Max Pool Size = 160000; Min Pool Size = 0;CHARSET=utf8";
          }
          public static MySql.Data.MySqlClient.MySqlConnection MySqlConnection
          {
              get
              {
                  MySql.Data.MySqlClient.MySqlConnection conn = new MySql.Data.MySqlClient.MySqlConnection();
                  conn.ConnectionString = ConnectionString;
                  return conn;
              }
          }
  </code></pre>
  
  <p>my problem is when i select string from utf-8 datebase with that code </p>
  
  <pre><code>public void accf()
          {
              MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
              cmd.Select("med").Where("Name", MName.Text).Or("UID", MUID.Text).Execute();
              MySqlReader r = new MySqlReader(cmd);
              if (r.Read())
              {
                  CharName.Text = r.ReadString("Name");
              }
              else
              {
                  fnf.ForeColor = Color.Red;
                  fnf.Text = "can't found anything";
                  fnf.Visible = true;
              }
          }
  </code></pre>
  
  <p>whatever the string at Name was number it can read it but when it was anyname the program told me that can't found anything
  and here is the table</p>
  
  <pre><code>DROP TABLE IF EXISTS `med`;
  CREATE TABLE `med` (
    `Name` varchar(16) CHARACTER SET utf8 NOT NULL,
    `UID` bigint(18) unsigned NOT NULL,
    `Substance` varchar(45) CHARACTER SET utf8 NOT NULL,
    `Expiry` date DEFAULT NULL,
    `Type` tinyint(5) unsigned DEFAULT '10',
    `Note` varchar(18) DEFAULT NULL,
    PRIMARY KEY (`UID`)
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
  </code></pre>
  
  <p>sorry for bad English i hope that can help to solve my problem </p>