Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QSqlQuery for ms access database

    General and Desktop
    4
    24
    1369
    Loading More Posts
    • 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.
    • behruz montazeri
      behruz montazeri @SGaist last edited by behruz montazeri

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

      1 Reply Last reply Reply Quote 0
      • RonaldViscarraL
        RonaldViscarraL last edited by

        try this:

        QSqlQuery  query ;
        query.prepare("SELECT * FROM names where name like '%?%'" );
        query.addBindValue("a");
        
        1 Reply Last reply Reply Quote 0
        • RonaldViscarraL
          RonaldViscarraL last edited by

          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);
          
          behruz montazeri 1 Reply Last reply Reply Quote 1
          • behruz montazeri
            behruz montazeri @RonaldViscarraL last edited by

            @ronaldviscarral
            Thank you very much it works now.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post