Solved MySQL & SELECT

Discussion in 'Rust Development' started by Шалун, Jun 8, 2016.

  1. Hi!

    Code:
    var sql = Sql.Builder.Append("SELECT * FROM table WHERE id = 1");            string text = "0";
                _mysql.Query(sql, MySQL_conn, list =>
                {
                    if (list == null)
                    {
                        return;
                    }
                    else
                    {
                        foreach (var entry in list)
                        {
                            try
                            {
                                text = Convert.ToString(entry["field_name"]);
                            }
                            catch
                            {
                                return;
                            }
                            break;
                        }
                    }
                });
                Puts(text);
    in field_name value = "1". But Puts(text) = "0"
     
  2. Queries are executed concurrently, your callback may be executed way later than Puts(text);.