Hi,

I think this is almost a nobrainer , but i am going to ask it anyway as I dont't want to waste any more time on this,

I am using SQlite database in my application and i want to update a value in a table where the value is calculated and stored in a variable . i am wondering how to pass the variables value to the column i want to update ..

my code looks like this

Qt Code:
  1.  
  2. q.exec("SELECT PRESSURE_HIGH, PRESSURE_LOW FROM PRESSURE_TBL");
  3.  
  4. q.next();
  5.  
  6. sensorHigh = q.value(0).toFloat();
  7.  
  8. sensorLow = q.value(1).toFloat();
  9.  
  10. sensorRange = qAbs(sensorHigh)+qAbs(sensorLow);
  11.  
  12. currentanalogIP = ((analogInput)/12);
  13.  
  14. currentDP = (sensorRange*currentanalogIP)+sensorLow;
  15.  
  16. q.exec("UPDATE PRESSURE_TBL SET CURRENT_DP = currentDP ");
  17.  
  18. // I am stuck here ....
To copy to clipboard, switch view to plain text mode 


I am wondering how to pass the currentDP variable to update the column CURRENT_DP in the table

any help would be highly appreciated,

Thanks.