![QT & SQLite - driver not loaded[Win7 XP mode failed too],第1张 QT & SQLite - driver not loaded[Win7 XP mode failed too],第1张](/aiimages/QT+%26amp%3Bamp%3B+SQLite+-+driver+not+loaded%5BWin7+XP+mode+failed+too%5D.png)
QT & sqlite - driver not loaded
Hello!Reply With Quote 21st July 2010,01:15 #2 wysota Master of Zen Join Date Jan 2006 Location Warsaw,Poland posts 28,434 Thanks 3 Thanked 4,110 Times in 3,960 posts Qt products Platforms Blog EntrIEs 4 Wiki edits 10 Re: QT & sqlite - driver not loaded
I'm trying to read from sqlite database. I've wrote simple function:
Qt Code: Switch viewTo copy to clipboard,switch vIEw to plain text modevoID MainWindow :: odczytajBazesql ( ) { QSqlDatabase addDatabase ( "QsqlITE" ); QSqlDatabase bdb; bdb. setDatabasename "/test.db" ); bdb. open ); QSqlQueryModel *queryModel = new QSqlQueryModel; queryModel ->setquery "SELECT * FROM t1",bdb ); ui ->tableVIEw ->setModel (queryModel ); }
test.db is a simple database with one table t1. When I'm trying to read with code above I get error:
Qt Code: Switch view: QSQLITE driver not loaded : available drivers : QSqlQuery exec : database not open
normally I'm using sqlite3 to create and use databases. What should I do to make it work?
thanks in advance
best regards
Tomasz
QsqlDatabase: available drivers: You don't seem to have any Qt sql drivers installed. Maybe you need to install some additional packages for your distribution.
Your biological and technological distinctiveness will be added to our own. Resistance is futile.Reply With Quote The following user says thank you to wysota for this useful post:
Please ask Qt related questions on the forum and not using private messages or visitor messages.
Tomasz(21st July 2010)10:22 #3 Tomasz Intermediate user Join Date Jul 2010 Location Poland posts 184 Thanks 70 Thanked 4 Times in 4 posts Qt products Platforms Re: QT & sqlite - driver not loaded
I've copIEd compilled driver (it wasn't there),I've change my code to:
Qt Code: Switch viewQsqlDatabase bdb = ); bdb. "./test.db" ); ok = bdb. );
and now It works fine,
best regards
Tomasz
Last edited by Tomasz; 21st July 2010 at 10:30.Reply With Quote 10:28 #4 wysota Master of Zen Re: QT & sqlite - driver not loaded
Change your code to:
Qt Code: Switch viewReply With Quote @H_760_419@ The following user says thank you to wysota for this useful post:Tomasz(21st July 2010)22nd July 2010,18:13 #5 sadjoker Novice Join Date Feb 2008 posts 50 Thanks 1 Thanked 2 Times in 2 posts Qt products Platforms Re: QT & sqlite - driver not loadedHello all. As we are speaking about sqlITE driver i had a very stressful experIEnce with that driver (4.6.2/4.6.3). I deployed over 100 copIEs of one program using latest sqlite driver. There was no problem anywhere... i put the dll file under the executable file in directory "sqldrivers".
Only in some particular systems this new driver wasn`t loading... i was like O_o. I`m talking about 2% of all the systems.
I`ve spent a lot of hours deBUGging remotely the machines and dIDn`t find a way to make it work. But i knew my old software worked on those machines before... then i switched to a sqlite dll from 4.4.0 and .. magically the driver was loaded!
Apparently something in the driver changed but i Couldn`t find time to investigate further.
Edit: the machines were WinXP Pro SP3.Last edited by sadjoker; 22nd July 2010 at 18:23.总结以上是内存溢出为你收集整理的QT & SQLite - driver not loaded[Win7 XP mode failed too]全部内容,希望文章能够帮你解决QT & SQLite - driver not loaded[Win7 XP mode failed too]所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)