1
Hello.
How do I add all the data inside tableView
in the database?
I’m adding data to tableView
with QStandardItem
//TableView
count = ui->tableView->verticalHeader()->count();
verticalHeader.append(QString::number(count + 1));
model.setVerticalHeaderLabels(verticalHeader);
item00 = new QStandardItem(ui->comboBox->currentText());
model.setItem(count, 0, item00);
ui->tableView->setModel(&model);
//insert sqlite
QSqlQuery qry;
qry.prepare("INSERT INTO entrada (entrada_produto) VALUES (?)");
qry.addBindValue(ui->comboBox->currentText());
qry.exec();
You should take a look at that link.
– user2692
In the link only tells how to update in the selected field. I want to add all data from tableView in db.
– Hy-brazil
No more details of DB is difficult. Put what you have tried, there gives to help better.
– Bacco
@Bacco Hello. What I would like is to pick up each row(Row) just a column from the
tableView
and add to db.DB = | id PRIMARY KEY | lista |
I edited the Post with additional code.– Hy-brazil
@Bacco Sqlite. Post updated.
– Hy-brazil
@user628298 put a version based on yours, with the query together, if someone read the answer and want the full version.
– Bacco
Blz. No problem, you can leave your code :)
– Hy-brazil