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. QSqlQuery for ms access database
Forum Updated to NodeBB v4.3 + New Features

QSqlQuery for ms access database

Scheduled Pinned Locked Moved Solved General and Desktop
24 Posts 4 Posters 3.5k Views 1 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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 30 Aug 2019, 20:06 last edited by
    #15

    What I am asking for is an example without binding that is working. Once we have that it should be easier to come with a solution.

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

    B 1 Reply Last reply 1 Sept 2019, 10:23
    2
    • S SGaist
      30 Aug 2019, 20:06

      What I am asking for is an example without binding that is working. Once we have that it should be easier to come with a solution.

      B Offline
      B Offline
      behruz montazeri
      wrote on 1 Sept 2019, 10:23 last edited by
      #16

      @sgaist
      I have no idea.

      S 1 Reply Last reply 2 Sept 2019, 06:16
      0
      • R Offline
        R Offline
        RonaldViscarraL
        wrote on 1 Sept 2019, 19:23 last edited by
        #17

        Hi, the use of % instead of * is the right way. The * is only for using it directly on ms access query.

        WHat version of ms access are you using? could you post a screenshot of your database/table?

        B 2 Replies Last reply 2 Sept 2019, 04:10
        0
        • R RonaldViscarraL
          1 Sept 2019, 19:23

          Hi, the use of % instead of * is the right way. The * is only for using it directly on ms access query.

          WHat version of ms access are you using? could you post a screenshot of your database/table?

          B Offline
          B Offline
          behruz montazeri
          wrote on 2 Sept 2019, 04:10 last edited by behruz montazeri 9 Feb 2019, 04:44
          #18

          @ronaldviscarral
          Thanks for your response here is my screenshot :
          image Info
          link imaget

          1 Reply Last reply
          0
          • R RonaldViscarraL
            1 Sept 2019, 19:23

            Hi, the use of % instead of * is the right way. The * is only for using it directly on ms access query.

            WHat version of ms access are you using? could you post a screenshot of your database/table?

            B Offline
            B Offline
            behruz montazeri
            wrote on 2 Sept 2019, 04:40 last edited by behruz montazeri 9 Feb 2019, 04:41
            #19
            This post is deleted!
            1 Reply Last reply
            0
            • B behruz montazeri
              1 Sept 2019, 10:23

              @sgaist
              I have no idea.

              S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 2 Sept 2019, 06:16 last edited by
              #20

              @behruz-montazeri said in QSqlQuery for ms access database:

              @sgaist
              I have no idea.

              Something like "SELECT * FROM names where name like '%foo%'" to confirm that one is working properly.

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

              B 1 Reply Last reply 2 Sept 2019, 07:03
              0
              • S SGaist
                2 Sept 2019, 06:16

                @behruz-montazeri said in QSqlQuery for ms access database:

                @sgaist
                I have no idea.

                Something like "SELECT * FROM names where name like '%foo%'" to confirm that one is working properly.

                B Offline
                B Offline
                behruz montazeri
                wrote on 2 Sept 2019, 07:03 last edited by behruz montazeri 9 Feb 2019, 10:05
                #21

                @sgaist
                Yes that works.Then what should be inside the % % instead of foo for binding ???
                what about binding ??

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  RonaldViscarraL
                  wrote on 2 Sept 2019, 19:28 last edited by
                  #22

                  try this:

                  QSqlQuery  query ;
                  query.prepare("SELECT * FROM names where name like '%?%'" );
                  query.addBindValue("a");
                  
                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    RonaldViscarraL
                    wrote on 2 Sept 2019, 20:15 last edited by
                    #23

                    I tested in Qt using access both 32 bits, this code works for me:

                    QString st = "a";
                    query->prepare("SELECT * FROM names WHERE name LIKE ?;");
                    
                    QString criteria("%" + st + "%");
                    query->addBindValue(criteria);
                    
                    B 1 Reply Last reply 3 Sept 2019, 03:56
                    1
                    • R RonaldViscarraL
                      2 Sept 2019, 20:15

                      I tested in Qt using access both 32 bits, this code works for me:

                      QString st = "a";
                      query->prepare("SELECT * FROM names WHERE name LIKE ?;");
                      
                      QString criteria("%" + st + "%");
                      query->addBindValue(criteria);
                      
                      B Offline
                      B Offline
                      behruz montazeri
                      wrote on 3 Sept 2019, 03:56 last edited by
                      #24

                      @ronaldviscarral
                      Thank you very much it works now.

                      1 Reply Last reply
                      0

                      24/24

                      3 Sept 2019, 03:56

                      • Login

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