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 Update on Monday, May 27th 2025

QSqlQuery for ms access database

Scheduled Pinned Locked Moved Solved General and Desktop
24 Posts 4 Posters 3.5k Views
  • 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 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

          21/24

          2 Sept 2019, 07:03

          • Login

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