Maison > Questions et réponses > le corps du texte
P粉7104549102023-07-25 11:53:11
Je suis relativement nouveau sur MySQL. Il s'agit d'une requête avec des paramètres.
string query = String.Format("UPDATE buildings JOIN server_buildings ON buildings.global_id = server_buildings.global_id AND buildings.level = server_buildings.level SET buildings.storage = buildings.storage + (server_buildings.speed * ?Num * IF(buildings.boost >= NOW(), 2, 1)) WHERE buildings.global_id IN('generator', 'test')"); using (MySqlCommand command = new MySqlCommand(query, connection)) { MySqlParameter param = new MySqlParameter("?Num", (deltaTime / 3600d)); command.Parameters.Add(param); command.ExecuteNonQuery(); }