title: Datatable C# Input string was not in a correct format
body: <p>My code:</p>
  
  <pre><code>DataTable dt = new DataTable();
  mySqlDataAdapter.Fill(dt);
  int socot = dt.Rows.Count;
  for (int i = 0; i &lt; socot; i++)
  {
      String dn = dt.Rows[i][1].ToString();
      String gduan = "SELECT tennha FROM duannha WHERE id=@id";
      MySqlCommand cmd = new MySqlCommand();
      cmd.Connection = conn;
      cmd.CommandText = gduan;
      cmd.Parameters.AddWithValue("@id", dn);
      String gtennha = cmd.ExecuteScalar().ToString();
      dt.Rows[i][1] = gtennha;
  }
  </code></pre>
  
  <p>When I run code, I received an error. Please help me fix it.</p>
  
  <p><a href="https://i.stack.imgur.com/1EPLb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1EPLb.png" alt="error"></a></p>