But i want to insert the content of the variables Temperature and Humidity, type float.
If I change it to %f, it does not change anything.
I guess i need to tell the variables Temperature and Humidity must be used, but cannot make it happen. Replace the %d by Temperature or @Temperature (like in SQL) the error is gone, but NULL data is inserted except date and time.
Can anyone get me on the right direction? Thanks in advance!
Since you can pass values manually/hard coded, have you printed to console the variable values to insure what is being passed? If it's expecting a float what is the variable value and format
It compiles, but it generetes an error during inserting.
Error message is:
10:24:13.511 -> Error: 207 = You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'float)(Temperature),1),((float)(Humidity),1), Now())' at line 1.
Changed the column datatype from float to decimal. But this doesn't make any difference
It looks to me as though you have some example code that was intended to be used with sprintf. Can you post the code that does the insert as well as your char array?