diff --git a/TcpServer.pro.user b/TcpServer.pro.user index f0024c8..864b31f 100644 --- a/TcpServer.pro.user +++ b/TcpServer.pro.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -94,7 +94,7 @@ Desktop Qt 6.2.3 MinGW 64-bit Desktop Qt 6.2.3 MinGW 64-bit qt.qt6.623.win64_mingw_kit - 1 + 2 0 0 @@ -179,7 +179,47 @@ Qt4ProjectManager.Qt4BuildConfiguration 2 - 2 + + C:\Users\25761\Desktop\build-TcpServer-Desktop_Qt_6_2_3_MinGW_64_bit-111 + C:/Users/25761/Desktop/build-TcpServer-Desktop_Qt_6_2_3_MinGW_64_bit-111 + + + true + QtProjectManager.QMakeBuildStep + false + + + + true + Qt4ProjectManager.MakeStep + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + clean + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + false + + 1112 + Qt4ProjectManager.Qt4BuildConfiguration + 0 + 0 + + 3 0 diff --git a/database.cpp b/database.cpp index 72688d3..94242ae 100644 --- a/database.cpp +++ b/database.cpp @@ -150,25 +150,23 @@ bool DataBase::match(QString name, QString pwd) QSqlQuery query(db_); query.prepare(sql); query.bindValue(":name",QVariant(name)); - if(!query.exec()) + if(query.exec()) { - qDebug() << "match fail" << db_.lastError().text(); - return false; - } - - //匹配密码 - if(query.next()) - { - qDebug() << query.value(1).toString(); - if(!(pwd == query.value(1).toString())) + //匹配密码 + if(query.next()) { - return false; + qDebug() << query.value(1).toString(); + if(pwd == query.value(1).toString()) + { + return true; + } } } + //关闭数据库 db_.close(); - return true; + return false; }