c++ - Qt5 MYSQL "open()" method return true even with wrong credentials -
while writing qt5 application uses qsqldatabase
mysql, encountered strange bug when try connect datebase. qsqldatabase::open()
returns true wrong username, password , port. that's code:
qsqldatabase db = qsqldatabase::adddatabase("qmysql", "connection"); db.sethostname(interface.inputip->text()); db.setdatabasename("connectdb"); db.setport(interface.inputport->value()); db.setusername(interface.inputlog->text()); db.setpassword(interface.inputpass->text()); bool result = db.open(); if(result) qmessagebox::information(0, "success", "connected"); else qmessagebox::information(0, "error", db.lasterror().text()); db.close();
is possible avoid bug?
Comments
Post a Comment