- Joined
- Jan 25, 2023
- Messages
- 1
- Reaction score
- 0
foreach (JProperty currency in currencyJson)
{
tCommand.Parameters.Clear();
tCommand.CommandText =
"INSERT INTO Currencies (ISO_CODE, VALUE ) VALUES(@isoCode, @value) ON DUPLICATE KEY UPDATE ISO_CODE = @isoCode";
Console.WriteLine(currency.Name);
tCommand.Parameters.AddWithValue("@isoCode", (string)currency.Name);
tCommand.Parameters.AddWithValue("@value", (double)currency.Value);
tCommand.ExecuteNonQuery();
}
So code above has error that i put on post thread. I cant find any solution to it. When i remove ON DUPLICATE KEY UPDATE ISO_CODE = @isoCode, code works just fine. Meanted code needs to be on my button refresh currency data, thats why i need this ON DUPLICATE KEY UPDATE, but for some reason it puts error on post thread. Sorry for my English.
{
tCommand.Parameters.Clear();
tCommand.CommandText =
"INSERT INTO Currencies (ISO_CODE, VALUE ) VALUES(@isoCode, @value) ON DUPLICATE KEY UPDATE ISO_CODE = @isoCode";
Console.WriteLine(currency.Name);
tCommand.Parameters.AddWithValue("@isoCode", (string)currency.Name);
tCommand.Parameters.AddWithValue("@value", (double)currency.Value);
tCommand.ExecuteNonQuery();
}
So code above has error that i put on post thread. I cant find any solution to it. When i remove ON DUPLICATE KEY UPDATE ISO_CODE = @isoCode, code works just fine. Meanted code needs to be on my button refresh currency data, thats why i need this ON DUPLICATE KEY UPDATE, but for some reason it puts error on post thread. Sorry for my English.