PDA

View Full Version : row QDataTable



cristiano
18th November 2006, 16:43
Hello,

The QDataTable only brings update the value of the first row, the others not.

I am trying this:

/********************************************/
register int i = dataTable->currentRow();
if ( i == -1 ) i = 0;

//QSqlRecord *getCurrentItemIdViatura = dataTable->currentRecord();

else if(i = 1)
{
QVariant getCurrentItemIdOcorrencia;
getCurrentItemIdOcorrencia = dataTable->value(0,0);

QString data = dataTable->text(2,2);

QSqlQuery queryUpdateChegada;
queryUpdateChegada.prepare( QUERY_GO_ARRIVEDOCCURRENCE "id_ocorrencia= :id_ocorrencia AND id_viatura= :id_viatura "
"AND id_cidade= :id_cidade ;" );

queryUpdateChegada.bindValue( ":id_ocorrencia", getCurrentItemIdOcorrencia );
queryUpdateChegada.bindValue( ":id_viatura", data );

queryUpdateChegada.bindValue( ":id_cidade", 8105);

if (queryUpdateChegada.exec())
{}
}

jacek
18th November 2006, 17:07
getCurrentItemIdOcorrencia = dataTable->value(0,0);
It looks like you always take the item id from the first row.