I stumble on this SQL statement whose code is this:
var query = "SELECT SUM(replace(montant_total_cmd, ',', '')) FROM Tble_Commande WHERE Annee = '" + Annee_en_Cour + "'";
using (var cmd = new SQLiteCommand(query, Program.Connex_Bdd))
int sum = Convert.ToInt32(cmd.ExecuteScalar());
Program.Montant_ttle = cmd.ExecuteScalar().ToString();
In this example I want to find the sum of (145.15 + 191.86 + 117.60 + 218.80) which normally makes 673.41
Who can help me find the true value with two digits after the decimal point?
What I have tried:
But with the value below I get 67341
and with the value below I get 67341.00
Despite my research, I can't get 673.41
In my Sqlite database I have commas and not REAL type points.
I had thought of this solution below but the result gives this 67341
double sum = Convert.ToInt32(cmd.ExecuteScalar());
MessageBox.Show("" + Math.Round(sum, 2));