for(intloop=1;loop<2;loop++)
{
QStringtest1=QString("insertinto%1values(%2,1,name%3,1);").arg(CSM_SQL_TABLE_STUDENT).arg(loop).arg(loop);
QStringtest2=QString("insertinto%1values(%2,1,name%2,1);").arg(CSM_SQL_TABLE_STUDENT).arg(loop);
// 以上两种方式均打印出:
test1 = "insert into student values(0, 1, name0, 1);"
test2 = "insert into student values(0, 1, name0, 1);"
QDateTime currentDateTime = QDateTime::currentDateTime();
QDate date = currentDateTime.date();
QTime time = currentDateTime.time();
QString dateTime = QString("%1-%2-%3 %4:%5:%6")
.arg(date.year())
.arg(date.month(), 2, 10, QChar('0')) // 表示2个字宽,10进制,未满字宽用'0'填补
.arg(date.day(), 2, 10, QChar('0'))
.arg(time.hour(), 2, 10, QChar('0'))
.arg(time.minute(), 2, 10, QChar('0'))
.arg(time.second(), 2, 10, QChar('0'));
dateTime的值为: 2014-06-23 17:27:06