xgoan
17th October 2006, 20:08
bool crearTablas(QWidget *parent){
QSqlQuery query("CREATE TABLE itinerario(id INTEGER, nombre VARCHAR(32), tipo_sendero INTEGER, "
"municipio VARCHAR(25), fecha_visita DATE, punto_salida VARCHAR(25), punto_llegada VARCHAR(25), "
"zona VARCHAR(25), provincia VARCHAR(25), fecha DATE, mapa VARCHAR(25), modo_realizacion INTEGER);");
if(!query.exec()){
QMessageBox::critical(parent, "", query.lastError().text());
return false;
}
return true;
}
Is this code wrong? I'm trying to query a database created in another function and it gives the error:
SQL logic error or missing database Unable to fetch row
But if I redo the query the error changes to:
table itinerario already exists Unable to fetch
Any help?
QSqlQuery query("CREATE TABLE itinerario(id INTEGER, nombre VARCHAR(32), tipo_sendero INTEGER, "
"municipio VARCHAR(25), fecha_visita DATE, punto_salida VARCHAR(25), punto_llegada VARCHAR(25), "
"zona VARCHAR(25), provincia VARCHAR(25), fecha DATE, mapa VARCHAR(25), modo_realizacion INTEGER);");
if(!query.exec()){
QMessageBox::critical(parent, "", query.lastError().text());
return false;
}
return true;
}
Is this code wrong? I'm trying to query a database created in another function and it gives the error:
SQL logic error or missing database Unable to fetch row
But if I redo the query the error changes to:
table itinerario already exists Unable to fetch
Any help?