bool ok1 = query.exec("create table user("
"uid int primary key autoincrement,"
"uloginName varchar,"
"upassword varchar,"
"uname varchar(20),"
"sex varchar(4),"
"age smallint,"
"hight smallint,"
"wight smallint,"
"telphone varchar(14),"
"address varchar(40),"
"idCard varchar(40),"
"email varchar(30),"
"intruoduct varchar,"
"introductsick varchar)");
//病人表
qDebug()<<"1"<<ok1;
一直返回false,烦死了,用的是QT下的MYSQL
第二行autoincrement写错了,应该是AUTO_INCREMENT
varchar这种类型的数据应该一个长度,分别在第3,4,14,15行
如果还是不行,将sql写在同一行,因为可能是你拼接SQL语句字符串出错。