本文共 1370 字,大约阅读时间需要 4 分钟。
QSqlDatabase::database().transaction(); QSqlQuery query; query.exec("SELECT id FROM employee WHERE name = 'Torild Halvorsen'"); if (query.next()) { int employeeId = query.value(0).toInt(); query.exec("INSERT INTO project (id, name, ownerid) " "VALUES (201, 'Manhattan Project', " + QString::number(employeeId) + ")"); } QSqlDatabase::database().commit(); |
转载地址:http://wfzoa.baihongyu.com/