When I insert a name, create two rows
Here is insert statement
void wmtDB
::addEmployee(QString name
) {
qry.prepare("INSERT INTO employeestuff (name) VALUES (:name)");
qry.bindValue(":name", name );
if (!qry.exec())
qFatal("Failed to add employee");
}
void wmtDB::addEmployee(QString name)
{
QSqlQuery qry;
qry.prepare("INSERT INTO employeestuff (name) VALUES (:name)");
qry.bindValue(":name", name );
if (!qry.exec())
qFatal("Failed to add employee");
}
To copy to clipboard, switch view to plain text mode
and here the call
void MainWindow::buttonOnClick()
{
employees.addEmployee(ui->lineEdit->text());
updateEmployees();
}
void MainWindow::buttonOnClick()
{
employees.addEmployee(ui->lineEdit->text());
updateEmployees();
}
To copy to clipboard, switch view to plain text mode
if db is empty and i run it one time with parameter "john"
the "SELECT * FROM nameTable"
will return
1 "john"
2 "john"
please help me
Bookmarks