I have used the following code to connect to the mysql database, the connection succeeds, but nothing is happened in the database and also no table is created and the rows are not indeed updated. Kindly help me on this issue..
QSqlDatabase db= QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DRIVER={MYSQL ODBC 3.51 Driver};FIL={MYSQL};DBQ=screengrabber");
db.setHostName("localhost");
db.setUserName("root");
db.setPassword("1");
ok = db.open();
QSqlQuery query;
query.exec("create table person (id int primary key, "
"firstname varchar(20), lastname varchar(20))");
query.exec("insert into person values(101, 'Danny', 'Young')");
Default Re: MYSQL Qt connectivity?? I have used the following query which succees in inserting into the table. But how to bind the values instead of directly giving the values as below::
Qt Code:
bool qrylog=querylog.exec("INSERT INTO service_log (ip_address,date_time, service_status, logged_user) " "VALUES ('172.16.0.51','2011-07-28 15:55:09',1,'ramachandran')");
Here in database ip_address is varchar(20), date_time is datetime, service_status is integer and logged_user is varchar(30). Please help me fixing this issue::