Dear all,
Any one have idea about how to compare the listwidet data with Database table with each row?
Printable View
Dear all,
Any one have idea about how to compare the listwidet data with Database table with each row?
Dear All
Here is my snippet code
can any one help me how to change the value in the DB table once we
change the check box in list widget
i have some list of data in listwidget.
ii chance second check box enable & three checkbox Disable
after i am calling this below function ?
Code:
void FC::Config() { { TInt NCounts = ui.listWidget->count(); TBuf<100> CCounts; CCounts.AppendNum(NCounts); int i; int j =1; for(i=0; i<NCounts; i++) { if(ui.listWidget->item(i)->checkState() == Qt::Checked) { bool ret; QSqlQuery query; ret = query.prepare(QString("UPDATE Table SET Enable = :Enable, Disable = :Disable where id = %1").arg(j)); if(ret) { //query.bindValue(":Enable", ); //query.bindValue(":Disable", ); ret = query.exec(); } } else { QSqlQuery query; bool ret; ret = query.prepare(QString("UPDATE Table SET Enable = :Enable, Disable = :Disable where id = %1").arg(j)); if(ret) { //query.bindValue(":Enable", ); //query.bindValue(":Disable", ); ret = query.exec(); } } j++; } } }
You change the data by executing an SQL update (or insert or delete)... but clearly you already know that.Quote:
can any one help me how to change the value in the DB table once we
change the check box in list widget
You need to explain the problem. What exactly happens when you uncomment and complete the bindValue() calls? Why is that not what you expected? What have you tried to overcome whatever the problem is?
Other observations:
- A table named "Table" is likely to be a problem for many RDBMSs
- With a bit of re-arrangement you probably only need to prepare the query once
- It is really poor etiquette to create a second thread to advertise another; doubly so when the original request is barely 12 hours old.
thx for all,
problem sloved