Solved Wont show another window
-
-
@Eternus said in Wont show another window:
AND password :password
Your query is still wrong. If you do not know what to put here you are going to struggle with MySQL.
-
@JonB query.prepare(QString("SELECT * FROM Users_QT WHERE username = :username AND password = :password"));
if i put this its like before nothing show me ... not even that : QMessageBox::information(this, "Failed", "Nepodarilo sa pripojit na query");
-
@Eternus said in Wont show another window:
not even that : QMessageBox::information(this, "Failed", "Nepodarilo sa pripojit na query");
That's because for the first time you actually have a legitimate query.
-
@JonB what you mean ?
i just following the tutorial.. and in turorial its works... -
@Eternus
You couldn't have followed whatever tutorial, because first you wroteAND password
then you wrote
AND password :password
and now you write
AND password = :password
So how could the tutorial you are following have all 3 of these, when only the last one is a correct query? And you had at least your
query.bindValue()
s wrong, I don't know what else. Maybe you have not been correctly copying from the tutorial? -
Beside the good points of @JonB, does your database actually contain data ?
-
@Eternus
Your code now does not error because it is syntactically correct. If it does not enter your output loop it is because there are simply no matching records for yourSELECT
statement. Either no rows have the username/password you are supplying, or as @SGaist says you simply have not put any rows into the table. -
@JonB Solved thanks guyz
-
@Eternus said in Wont show another window:
Solved thanks guyz
Would you mind sharing what the solution was? For the benefit of other users of the forum...
-
@Pablo-J-Rogina
```
QSqlQuery query(QSqlDatabase::database("QTUSERS"));to
QSqlQuery query(QSqlDatabase::database("MyConnect"));
and ``` query.prepare(QString("SELECT * FROM Users_QT WHERE username = :username AND password"));
to
```
query.prepare(QString("SELECT * FROM Users_QT WHERE username = :username AND password = : password"));