Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have table ISSUEPASS contains different rows with same PassID and mobile no.I want to get the PassID with the mobile no.I need to select only one row.I have tried below but Iam getting error "Unable fetch row,No query",Can you please provide me the solution.

QSqlQuery qry;
qry.prepare("SELECT DISTINCT(PassID) FROM ISSUEPASS WHERE mobno = '"+ui->lineEdit_mobno2->text()+"' ");

What I have tried:

QSqlQuery qry;
qry.prepare("SELECT DISTINCT(PassID) FROM ISSUEPASS WHERE mobno = '"+ui->lineEdit_mobno2->text()+"' ");
Posted
Updated 2-Apr-18 6:25am

1 solution

Hi,

Did you do a qry.exec() ?

The prepare() returns a true if successful or a false if there was a problem. What is the return status of prepare.

Have you tried running the query through the sqlite interface to see how it acts?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900