[Qt-interest] 答复: [?? Probable Spam] Re: Can not load qsqlite4.dll

吴海峰 wuhf at nari-relays.com
Wed Oct 21 02:21:16 CEST 2009


If I do not load the plugin, the open() method will fail.

QSqlDatabase db = QsqlDatabase::addDatabase("QSQLITE", "conn1");
db.setDatabaseName(str_db_file_name);

qDebug() << db.open();

It produces that the open() will fail.

发件人: Bill King [mailto:bill.king at nokia.com]
发送时间: 2009年10月21日 8:02
收件人: 吴海峰
抄送: Qt-interest at trolltech.com
主题: [?? Probable Spam] Re: [Qt-interest] Can not load qsqlite4.dll

On 10/21/2009 12:45 AM, ext 吴海峰 wrote:
Hello everybody.
         I have a problem described below.

    I use QPluginLoader to load qsqlite4.dll without success. (The executable is deployed in a new installed XP System.)
         I use VS2005 and Qt4.5.2.

    QString str_abs_path_to_sqlite("D:/qsqlite4.sql");  // it does exist.
    QPluginLoader *pLoader = new QPluginLoader(str_abs_path_to_sqlite);

    if(pLoader->load() == false)
         {
                   qDebug() << pLoader->errorString();
         }

         In logfile, it proves that it enters into the " qDebug() << pLoader->errorString();" logic.
         It says "Program is not installed correct. Reinstalling it may fix the problem" which indicated that manifest
    file is missing. But sqlite module is compiled in plugin mode and it embeds the mainfest already. Why it still produce the error above? I can not load qsqlite4.dll now.
         Plz help me out. Any suggestions and ideas are welcome. Thanks in advance.
         BTW, I have search the list but without luck.


Err, why are you manually loading the sqlite4 plugin?


QSqlDatabase::addDatabase() should handle that automatically for you...
eg: QSqlDatabase db=QSqlDatabase::addDatabase("QSQLITE", "sqlite db");


--

Bill King, Software Engineer

Qt Development Frameworks, Nokia Pty Ltd

Brisbane Office
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091021/a5fd527f/attachment.html 


More information about the Qt-interest-old mailing list