chetu1984
17th March 2011, 18:12
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
QSqlQuery q;
q.exec("SELECT PRESSURE_HIGH, PRESSURE_LOW FROM PRESSURE_TBL");
q.next();
sensorHigh = q.value(0).toFloat();
sensorLow = q.value(1).toFloat();
sensorRange = qAbs(sensorHigh)+qAbs(sensorLow);
currentanalogIP = ((analogInput)/12);
currentDP = (sensorRange*currentanalogIP)+sensorLow;
q.exec("UPDATE PRESSURE_TBL SET CURRENT_DP = currentDP ");
// I am stuck here ....
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.
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
QSqlQuery q;
q.exec("SELECT PRESSURE_HIGH, PRESSURE_LOW FROM PRESSURE_TBL");
q.next();
sensorHigh = q.value(0).toFloat();
sensorLow = q.value(1).toFloat();
sensorRange = qAbs(sensorHigh)+qAbs(sensorLow);
currentanalogIP = ((analogInput)/12);
currentDP = (sensorRange*currentanalogIP)+sensorLow;
q.exec("UPDATE PRESSURE_TBL SET CURRENT_DP = currentDP ");
// I am stuck here ....
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.