table:
QSqlQuery query;
query.exec("create table student(NO int primary key,name varchar(20))");
----------------
QSqlQuery query;
query.prepare("select name from student where NO=?");
int NO=ui->spinBox->value();
query.bindValue(":NO",NO);
query.exec();
/**************************************************************
**求的是NO=?时的name,返回值是一个,所以first(),valuse(0)
***************************************************************/
query.first();qDebug()<<query.value(0).toString();