When I use the following query to return the docile of the bank's data, the following message appears: QSqlQuery :: value: not positioned on a valid record
I use the same code model and it is working, only the one that does not, it follows the code below:
QString ConfereNome = ui->lineEditNovoCampo->text();
QSqlQuery queryVerificaSeCampoJaExiste("SELECT CdCampos FROM tbcampos WHERE NmCampos='"+ConfereNome+"'");
if(queryVerificaSeCampoJaExiste.exec())
{
while(queryVerificaSeCampoJaExiste.next());
{
VerificadorIdExisteOuNao = queryVerificaSeCampoJaExiste.value(0).toString();
qDebug()<<VerificadorIdExisteOuNao;
qDebug()<<"Codigo do compo selecionado com sucesso!";
}
}
else
{
qDebug()<<"Não foi possivel executar a query que verifica se o campo ja existe";
}