c++ - Inserting a new Record -
using below code can display records in database now.
mainwindow::mainwindow(qwidget *parent) : qmainwindow(parent), ui(new ui::mainwindow) { ui->setupui(this); this->setcentralwidget(ui->tableview); db = qsqldatabase::adddatabase("qmysql"); db.sethostname("localhost"); db.setdatabasename("employee"); db.setusername("root"); db.setpassword("password"); db.open(); model=new qsqltablemodel(this); model->settable("employee_details"); model->select(); ui->tableview->setmodel(model); }
how can insert new record?
also, can insert empty record , edit in later values?
thank you.
wiki
Comments
Post a Comment