Did you #include <qsqldatabase.h>?
Did you #include <qsqldatabase.h>?
Yes, I include these header files,
#include <qapplication.h>
#include "/usr/include/mysql/mysql.h"
#include <qsqldatabase.h>
#include <qsqlquery.h>
ok i solve the problem.
But now I had occure another one
I wand to execute a query in QT.
The following is the code...
================================================== ==
double id, mark1, mark2, mark3, total;
const char *name;
name = TxtName->text();
mark1 = TxtMark1->text().toDouble();
mark2 = TxtMark2->text().toDouble();
mark3 = TxtMark3->text().toDouble();
id = TxtMark4->text().toDouble();
total = mark1 +mark2+mark3;
QSqlQuery target;
QString sql = "insert into student ( s_id, s_name, s_mark1, s_mark2, s_mark3, s_total ) values( " ;
==================================================
After this i am stuck!!!!!!!!!!!
how can i add the values of the variables to that string ' sql ' ?
please help me......
sabeesh
================================================== ===
Sabeesh
Last edited by sabeeshcs; 11th January 2007 at 06:11.
Just example from docs...
Qt Code:
QSqlQuery query; query.prepare( "INSERT INTO atable (id, forename, surname) " "VALUES (:id, :forename, :surname)" ); query.bindValue( ":id", 1001 ); query.bindValue( ":forename", "Bart" ); query.bindValue( ":surname", "Simpson" ); query.exec();To copy to clipboard, switch view to plain text mode
p.s. Read this all !
a life without programming is like an empty bottle![]()
Thankyou for your help...
I wish to consentrate developing graphical application in QT. ie, I wish to create an object with the help of some messure. Can you give some documentation about that.
Bookmarks