January 11, 2011

pico pico
Lab Rat
20 posts

Could it be possible to have two different connections to handle two different databases?

 

Hi, Sir: I use QSqliteDatabase to addDatabse for two different files, however, it always show me “driver not loaded”. Could anyone teach me how to have two databases simultaneously?

PS: I don’t use “attach” way because I need to handle them as two different connections. Thanks a lot. BR, Pico

3 replies

January 11, 2011

Andre Andre
Robot Herder
6422 posts

Let me get this straight: you have no problems using a single SQLite database connection, but you can not make a second one work?

January 11, 2011

Volker Volker
Ant Farmer
5331 posts

You can call addDatabase() twice; just be sure to give different connection names in the two calls. In subsequent calls to QSqlDatabase::database() put the name of the desired connection to the argument list.

For your errors: Show us some code please, we cannot guess what you are doing.

January 11, 2011

pico pico
Lab Rat
20 posts

Hi, All: Thanks a lot. I just follow your recommendation, and it works now.

Thanks again…
 
  ‹‹ QML/3D: how to get a frameless window and transparent background      [Solved] Qt layout direction and window title bar ››

You must log in to post a reply. Not a member yet? Register here!