So far, we have been running queries, but not getting any data in return. One of the points of a database is to query for data, not just to enter it. What fun would it be if we could only input data? The Qt API has a way to accommodate the different syntax and millions of ways a query can be made. Most of the time, it is specific to the type of data you need to be returned, but also specific to the database data itself. Luckily, QSqlQuery is general enough that the query parameter is a string.
Executing queries
QSqlQuery
To retrieve data, execute a query using QsqlQuery and then operate on the records using the following functions:
- first()
- last()
- next()
- previous()
- seek(int)
The first() and last() functions will...