Problem with Query - QODBC, Informix
-
@ObiWan
No, still not working :(@edit I changed some options in IBM Informix ODBC driver setup, now it looks like:
https://img42.com/AGfcv
And now I'm getting this error:
QODBCResult::exec: Unable to execute statement: "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement." -
@ObiWan
Yes, I just copied your code to mine.
void pacjenci_window::on_dodaj_clicked()
{
QSqlQuery uQuery = QSqlQuery(db);
uQuery.prepare("INSERT INTO pacjent(nr_ubezpieczenia, imie_pacjenta, nazwisko_pacjenta, adres_pacjenta, telefon_pacjenta) VALUES(?, ?, ?, ?, ?)");
uQuery.bindValue(0 ,ui->nr_ub->text());
uQuery.bindValue(1 ,ui->imie->text());
uQuery.bindValue(2 ,ui->nazwisko->text());
uQuery.bindValue(3 ,ui->adres->text());
uQuery.bindValue(4 ,ui->nr_tel->text());
uQuery.exec();
sQuery.prepare("SELECT * FROM pacjent");
if(!sQuery.exec()){
qDebug() << uQuery.lastError().text() << " DODAJ BUTTON select";
}
sQuery.last();
FillForm();
}
@added qDebug to uQuery too, new error:
QODBCResult::exec: Unable to execute statement: "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement."
"[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement. QODBC3: Unable to execute statement" DODAJ BUTTON insert -
toStdString() - error:
C:\Users\michu\Documents\przychodnia_projekt\pacjenci_window.cpp:60: błąd: no matching function for call to 'QSqlQuery::bindValue(int, std::string)'
uQuery.bindValue(1 ,ui->imie->text().toStdString());
^
Trying to add additional variables with toStdString() and then add them to bindvalue by name but dont work too.toLocal8bit() - the same error as on begin:
QODBCResult::exec: Unable to execute statement: "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement."
"[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement. QODBC3: Unable to execute statement" DODAJ BUTTON insert@edit:
trying with toUtf8() - same error like above.
with toWCharArray() - same error like toStdString()@edit
for toStdString() & toUtf8 I added data() but now error is the same like for others...uQuery.bindValue(1 ,ui->imie->text().toUtf8().data());
error:
QODBCResult::exec: Unable to execute statement: "[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement."
"[Informix][Informix ODBC Driver][Informix]CURSOR not on SELECT statement. QODBC3: Unable to execute statement" DODAJ BUTTON insert -
Yes! I found solution. Its simply uncheck option Insert Coursor in ODBC IBM driver config...
Like on picture:
https://img42.com/r4DZU
Thanks guys for support. -
hi,@Mich-Q ,i'm new about qt and informix, i need informix driver,can you sent it to me.if it is win32,it is better,can you?my english is terrible-.-。thank you.
-
Hi and welcome to the forums
you can use ODBC for connecting Qt to informix server.
As far as i know there is no native Qt driver for informix.https://www.ibm.com/developerworks/data/library/techarticle/dm-1108odbcdrivermanager/index.html
Sorry I dont its download link.
-
@mrjj hi,i know there is no native qt driver for informix.when i saw this topic ,i find https://img42.com/r4DZU,there is a dialog which title is "ibm informix odbc driver setup", i think you have the informix odbc driver...
i guess you dont have informix odbc driver,is that right? -
@erick-joshua
Yes, Qt do not come with ODBC drivers. They are supplied by the vendors or microsoft.
Oddly i cannot find a download link at IBM.
Even other pages mention it
http://www.ciscounitytools.com/Applications/CxN/InformixODBC/InformixODBC.html
This seems to be the SDK
http://www.ciscounitytools.com/Applications/CxN/InformixODBC/clientsdk.4.10.TC7DE.WIN.zip
but i have no idea what version of the actual server it works with etc.