tags:

views:

44

answers:

2
QSqlQuery query;
QString queryString = "SELECT * FROM " + parameter3->toAscii() + " WHERE " + parameter1->toAscii() + " = \"" + parameter2->toAscii() + "\"";
bool retX = query.exec(queryString);

above code when bundled as an application returns true on the machine it has been created. it returns false on other machines. how is it possible to run this successfully on all machines. could it be a network, permission issue. help needed.

Brgds,
kNish

+1  A: 

In troubleshooting, if you isolate your query and it returns the result you anticipated ( such as you have done utilizing qt creator to verify the query returns a result of true), the next step would be to take a close look at your code and verify that you are passing the proper parameters into the query for execution.

I have a virgin machine I utilize for this purpose. I am a software engineer by trade and I am fully aware that i have a ton of software installed on my PC which the common user may/will not have installed. So the virgin allows me to test the code in stand-alone form.

I suggest implementing a message box prior to the execution of your query which shows the query to be executed. This will verify the query is correct on the "other machines".

Michael Eakins
messagebox show correct names from table. the dll's used are qsqlmysql4.dll, qsqlmysqld4.dll, mingwm10.dll, QtCore4.dll, QtCored4.dll, QtGuid4.dll. Could that be the question area.
knishua
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL"); // data necessary for the connection db.setHostName("xxx.xxx.xx.xx"); db.setDatabaseName("xxxxxxxx"); db.setUserName("xxxxx"); db.setPassword("xxxx"); db.open(); QSqlQuery query; QString queryString = "SELECT * FROM " + parameter3->toAscii() + " WHERE " + parameter1->toAscii() + " = \"" + parameter2->toAscii() + "\""; bool retX = query.exec(queryString); QMessageBox::information(0,"",QString::number(retX)); return retX;
knishua
A: 

Certain dll's were needed. in my case qtguid4.dll, qtcored4.dll and qtsqld4.dll. There was a size difference. Once matched it worked on a pc. However, on other pc's i still get an error "The application failed to initialize 0xc000007b ....."

How is it possible to make an application run.

Brgds,

kNish

knishua