S
S
Sazoks2020-08-14 14:00:50
Qt
Sazoks, 2020-08-14 14:00:50

Why does the QSqlQuery::value: not positioned on a valid record error occur?

There is this code:

static unsigned CountUpload = 0;
// получаем данные из БД
Query.exec("SELECT * FROM Channels LIMIT 10 OFFSET " + static_cast<QString>(10 * CountUpload));
// увеличиваем счетчик сделанных запросов
CountUpload++;
Query.next();
qDebug() << Query.value(0).toString();

Its meaning is that when requested, the next 10 channels from the database are sent to the client. For the sake of testing, I print the 0th field of the first record to the console, but it gives me the error described in the title. Tell me, please, what's wrong? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Ananiev, 2020-08-14
@SaNNy32

https://stackoverflow.com/questions/9000123/qsqlqu...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question