私は過去 5 時間、この手順を機能させるのに苦労してきました。私はそれが機能するポイントまでそれをトリミングして、それに基づいて構築しようとしましたが、それでもうまくいきません. 明日の朝、このプロジェクトを作業状態で提示しなければならないので、助けていただければ幸いです。
コードが非常に長いため、コードを削除しましたが、問題はまだ明らかです。
sqlCon.Connected := true; //TSQLConnection
sqlUsers.Active := true; //TSQLTable
sqlGames.Active := true; //TSQLTable
sqlPredictions.Active := true; //TSQLTable
sqlUsers.First;
//All following variables are integers.
rugbyChampionshipScore := 10;
rugbyChampionshipGamesPredicted:= 10;
rugbyChampionshipGamesCorrect:= 10;
rugbyChampionshipGamesAlmost:= 10;
rugbyChampionshipGamesWrong:= 10;
currieCupScore := 10;
currieCupGamesPredicted := 10;
currieCupGamesCorrect := 10;
currieCupGamesAlmost := 10;
currieCupGamesWrong := 10;
sqlQueryUpdate.Close; //TSQLQuery
sqlQueryUpdate.CommandText := 'UPDATE users SET overallScore=:parScore, overallGamesPredicted=:parGamesPredicted, overallGamesCorrect=:parGamesCorrect, overallGamesAlmost=:parGamesAlmost, overallGamesWrong=:parGamesWrong, overallAccuracy=:parAccuracy WHERE username=:parUsername';
sqlQueryUpdate.Params.Clear;
sqlQueryUpdate.Params.CreateParam(ftUnknown, 'parUsername', ptUnknown).AsString := sqlUsers.FieldByName('username').AsString;
sqlQueryUpdate.Params.CreateParam(ftUnknown, 'parScore', ptUnknown).AsInteger := Round((rugbyChampionshipScore + currieCupScore) / (rugbyChampionshipGamesPredicted + currieCupGamesPredicted));
sqlQueryUpdate.Params.CreateParam(ftUnknown, 'parGamesPredicted', ptUnknown).AsInteger := rugbyChampionshipGamesPredicted + currieCupGamesPredicted;
sqlQueryUpdate.Params.CreateParam(ftUnknown, 'parGamesCorrect', ptUnknown).AsInteger := rugbyChampionshipGamesCorrect + currieCupGamesCorrect;
sqlQueryUpdate.Params.CreateParam(ftUnknown, 'parGamesAlmost', ptUnknown).AsInteger := rugbyChampionshipGamesAlmost + currieCupGamesAlmost;
sqlQueryUpdate.Params.CreateParam(ftUnknown, 'parGamesWrong', ptUnknown).AsInteger := rugbyChampionshipGamesWrong + currieCupGamesWrong;
sqlQueryUpdate.Params.CreateParam(ftUnknown, 'parAccuracy', ptUnknown).AsInteger := Round(100 / (rugbyChampionshipGamesPredicted + currieCupGamesPredicted)*(rugbyChampionshipGamesCorrect + currieCupGamesCorrect) + ((rugbyChampionshipGamesAlmost + currieCupGamesAlmost)/2));
sqlQueryUpdate.ExecSQL();
sqlQueryUpdate.Close;
sqlUsers.Active := false;
sqlGames.Active := false;
sqlPredictions.Active := false;