Nominate our 2022 Qt Champions!

QT case insensitive

  • hi,

    hi have created Qt database ....i am using select command as searching option ....i need this search option as case insensitive (like Hai as hai hAI,......) ....please tell something.....

  • That depends on the database that you're using, not on Qt. Note that it is likely that for each database, the solution is different, as this is not a standard part of SQL.

  • thank you for your reply,
    i understand what u say, i don't where i can mention this case sensitive....

    this is my sample code,

    QSqlQuery query_re_pass(db);
    query_re_pass.exec("SELECT * FROM UserDetails WHERE UserName ='"+user_re_name+"'");

    this user_re_name --is my input,
    UserDetails -----is my table
    UserName -----is my column

  • Somewhere in your query, probably. Again: this depends on your database. With SqlLite, you can add "COLLATE NOCASE" to your query, but for other databases that may be different. And you are not specifying which database you are using.

  • i am using QSQLITE

  • thank you for reply ,
    i got output thank you very much......thanks a lot....

    i got output from this,,,,,
    QSqlQuery query_re_pass(db);
    if(db.isOpen()) { query_re_pass.exec(“SELECT * FROM UserDetails WHERE UserName =\’“user_re_name”\’ COLLATE NOCASE ”);

Log in to reply