tranfuga25s
16th August 2006, 02:56
I've got problems with this code:
QSqlQuery *cola = new QSqlQuery("SELECT id, pregunta, respuesta, referencia, dificultad, tema FROM preguntas");
if( cola->exec() )
{
while( cola->next() )
{
cout<<"-----------------------------------------------"<<endl;
cout<<"Numero de pregunta: "<<cola->value(0).toInt()<<endl;
cout<<"Tema:" <<cola->value(5).toInt()<<endl;
cout<<"Dificultad:" <<cola->value(4).toInt()<<endl;
cout<<"Texto: " <<cola->value(1).toString()<<endl;
cout<<"Respuesta:" <<cola->value(2).toString()<<endl;
cout<<"Referencia:" <<cola->value(3).toString()<<endl;
}
delete(cola);
return;
}
When run it, it's stops al the first .toString() output. If the last 3 outputs are not there the cycle work fine... Any Idea????...
Using Qt 3 with linux
Thanks
QSqlQuery *cola = new QSqlQuery("SELECT id, pregunta, respuesta, referencia, dificultad, tema FROM preguntas");
if( cola->exec() )
{
while( cola->next() )
{
cout<<"-----------------------------------------------"<<endl;
cout<<"Numero de pregunta: "<<cola->value(0).toInt()<<endl;
cout<<"Tema:" <<cola->value(5).toInt()<<endl;
cout<<"Dificultad:" <<cola->value(4).toInt()<<endl;
cout<<"Texto: " <<cola->value(1).toString()<<endl;
cout<<"Respuesta:" <<cola->value(2).toString()<<endl;
cout<<"Referencia:" <<cola->value(3).toString()<<endl;
}
delete(cola);
return;
}
When run it, it's stops al the first .toString() output. If the last 3 outputs are not there the cycle work fine... Any Idea????...
Using Qt 3 with linux
Thanks