MarkoSan
9th January 2006, 19:29
What is wrong with this code:
void CCustomerUpdateDialog::slotZipcodeChanged(int iIndex)
{
QSqlQuery retrieveCityNameQuery("SELECT * FROM kraj k WHERE k.POSTNA_STEVILKA="+m_pZipcode->currentText());
QSqlError error=retrieveCityNameQuery.lastError();
if(error.type()!=QSqlError::NoError)
{
qDebug() << retrieveCityNameQuery.lastError();
} else
{
m_pCity->setText(retrieveCityNameQuery.value(1).toString()) ;
}
};
I select a zip code of an city and in the QLineEdit should provide then after click the name of city with selected Zip Code. But, sql i generated ok (double check), QLineEdity still stays empty! Why?
void CCustomerUpdateDialog::slotZipcodeChanged(int iIndex)
{
QSqlQuery retrieveCityNameQuery("SELECT * FROM kraj k WHERE k.POSTNA_STEVILKA="+m_pZipcode->currentText());
QSqlError error=retrieveCityNameQuery.lastError();
if(error.type()!=QSqlError::NoError)
{
qDebug() << retrieveCityNameQuery.lastError();
} else
{
m_pCity->setText(retrieveCityNameQuery.value(1).toString()) ;
}
};
I select a zip code of an city and in the QLineEdit should provide then after click the name of city with selected Zip Code. But, sql i generated ok (double check), QLineEdity still stays empty! Why?