Qt接続mysqlクエリーデータ
QSqlDatabase db=QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("127.0.0.1");//mysql
db.setPort(3306);
db.setDatabaseName("thinkcmf");//
db.setUserName("root");//mysql
db.setPassword("xxx");//mysql
if(db.open())
{
qDebug()<<"success!";
qDebug()<"show tables from thinkcmf");//thinkcmf
while (query.next()) {
QString country = query.value(0).toString();
qDebug()<"select * from thinkcmf_menu");//
while (query1.next()) {
QString country = query1.value(0).toString();//cmf_menu 1
qDebug()<else{
qDebug()<<"failure";
}