stingray
15th September 2013, 13:03
if i do
QSqlQuery get_company_id;
QString stmt_get_company_id = "Select id from company where (name = ?) ;";
get_company_id.prepare(stmt_get_company_id);
get_company_id.bindValue(0, details[0]);
int int_company_id = get_company_id.exec();
qDebug() << " int_company_id = " + int_company_id;
atleast in my head i think it should pass the int value of the selected id to the int but it sure dont seem to do that, the qDebug() after says the int_company_id is null..
im pretty sure i've missed something basic on this one.. just cant get it do to what i want, as i have to insert in multiple instances because of foreign keys in the db, so i need this int, but dont know how to do it..
/Stingray
QSqlQuery get_company_id;
QString stmt_get_company_id = "Select id from company where (name = ?) ;";
get_company_id.prepare(stmt_get_company_id);
get_company_id.bindValue(0, details[0]);
int int_company_id = get_company_id.exec();
qDebug() << " int_company_id = " + int_company_id;
atleast in my head i think it should pass the int value of the selected id to the int but it sure dont seem to do that, the qDebug() after says the int_company_id is null..
im pretty sure i've missed something basic on this one.. just cant get it do to what i want, as i have to insert in multiple instances because of foreign keys in the db, so i need this int, but dont know how to do it..
/Stingray