Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Wont show another window
Forum Updated to NodeBB v4.3 + New Features

Wont show another window

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 5 Posters 1.1k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JonBJ JonB

    @SGaist said in Wont show another window:

    You are missing a : before password

    It is missing the whole = :password after password, I assume.

    E Offline
    E Offline
    Eternus
    wrote on last edited by Eternus
    #6

    @JonB @SGaist
    if i put this :

            query.prepare(QString("SELECT * FROM Users_QT WHERE username = :username AND password :password"));
    
    

    its says me this : if(!query.exec()){
    QMessageBox::information(this, "Failed", "Nepodarilo sa pripojit na query");

    but i dont know why mysql server running...

    JonBJ 1 Reply Last reply
    0
    • E Eternus

      @JonB @SGaist
      if i put this :

              query.prepare(QString("SELECT * FROM Users_QT WHERE username = :username AND password :password"));
      
      

      its says me this : if(!query.exec()){
      QMessageBox::information(this, "Failed", "Nepodarilo sa pripojit na query");

      but i dont know why mysql server running...

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #7

      @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.

      E 1 Reply Last reply
      0
      • JonBJ JonB

        @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.

        E Offline
        E Offline
        Eternus
        wrote on last edited by Eternus
        #8

        @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");

        JonBJ 1 Reply Last reply
        0
        • E Eternus

          @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");

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #9

          @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.

          E 1 Reply Last reply
          0
          • JonBJ JonB

            @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.

            E Offline
            E Offline
            Eternus
            wrote on last edited by
            #10

            @JonB what you mean ?
            i just following the tutorial.. and in turorial its works...

            JonBJ 2 Replies Last reply
            0
            • E Eternus

              @JonB what you mean ?
              i just following the tutorial.. and in turorial its works...

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by JonB
              #11

              @Eternus
              You couldn't have followed whatever tutorial, because first you wrote

              AND 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?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #12

                Beside the good points of @JonB, does your database actually contain data ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • E Eternus

                  @JonB what you mean ?
                  i just following the tutorial.. and in turorial its works...

                  JonBJ Online
                  JonBJ Online
                  JonB
                  wrote on last edited by JonB
                  #13

                  @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 your SELECT 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.

                  E 1 Reply Last reply
                  1
                  • JonBJ JonB

                    @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 your SELECT 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.

                    E Offline
                    E Offline
                    Eternus
                    wrote on last edited by
                    #14

                    @JonB Solved thanks guyz

                    Pablo J. RoginaP 1 Reply Last reply
                    0
                    • E Eternus

                      @JonB Solved thanks guyz

                      Pablo J. RoginaP Offline
                      Pablo J. RoginaP Offline
                      Pablo J. Rogina
                      wrote on last edited by
                      #15

                      @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...

                      Upvote the answer(s) that helped you solve the issue
                      Use "Topic Tools" button to mark your post as Solved
                      Add screenshots via postimage.org
                      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                      E 1 Reply Last reply
                      0
                      • Pablo J. RoginaP Pablo J. Rogina

                        @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...

                        E Offline
                        E Offline
                        Eternus
                        wrote on last edited by Eternus
                        #16

                        @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"));

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved