[Qt-interest] SQL code is not being called
Йордан Иванов
yordan.t.ivanov at gmail.com
Sun Jun 26 06:35:26 CEST 2011
Hi,
Try qDeugging the last error.
The method can be found here:
http://doc.qt.nokia.com/latest/qsqldatabase.html#lastError
На 25.06.2011 23:11, Sujan Dasmahapatra написа:
> Dear Friends
> In the following code after db.open(); my code is not being
> called.....I am checking it through debugger I can see after db.open()
> code goes down to the end . I want to check whether the tables can be
> seen or not. Please help me. Thanks sujan
> db=QSqlDatabase::addDatabase("QMYSQL");
> db.setHostName("localhost");
> db.setDatabaseName("MyDB");
> db.setUserName("guest");
> db.setPassword("guest12");
> dbok = db.open();
> qDebug() << dbok << "\n";
> qDebug() << db.drivers();
> qDebug() << QCoreApplication::libraryPaths();
> QStringList tablelist = db.tables(QSql::Tables);
> for(int i=0; i<tablelist.count(); i++)
> qDebug() << tablelist.at(i) << " ";
> QSqlTableModel *model = new QSqlTableModel(this, db);
> model->setTable("things");
> model->select();
> QTableView *view = new QTableView;
> view->setModel(model);
> view->show();
>
>
> --
> Thanks& Regards
> Sujan Dasmahapatra
> B.E. (Aeronautics)
> Bangalore, India
> Ph:91-9900839788
> mail id :sujan.dasmahapatra at gmail.com <mailto:sujan.dasmahapatra at gmail.com>
>
> yahoo msn :dasmahapatra.aerodynamics at yahoo.co.in <mailto:dasmahapatra.aerodynamics at yahoo.co.in>
> icq # 556023244
> skype:sujan.dasmahapatra at skyepe.com <mailto:skype%3Asujan.dasmahapatra at skyepe.com>
>
> msn:sujan.dasmahapatra at hotmail.com <mailto:sujan.dasmahapatra at hotmail.com>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
--
Поздрави,
Йордан Иванов
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110626/e168d96e/attachment.html
More information about the Qt-interest-old
mailing list