Qt database operation, detecting whether there is a table of data

When you add a record to the database, the first test to see if the record already exists.

For example, we want to add aa user to the users table, the first test to see whether aa user already exists.

Working with SQL statements

select count(*) form users where name='aa';

The statement returns the table name is 'aa' number.

Code can be written like this:

query.value (0) .toInt (); return count of count (*) function.

Guess you like

Origin blog.csdn.net/u014746838/article/details/92952050