PDA

View Full Version : Multiple open databases and MVC



mtnbiker66
24th March 2012, 19:06
All --

My application heavily relies on a model/view, connecting to a sqlite database, but now I'd like to off my user a chance to import another sqlite database, and I have no trouble getting both of them open, but is there a way to direct my models to know which database to get data from? Is there some way of directing the model->setTable("tablename") command to specify the database connection? I can perform the import via SQL but I'd prefer to set models on the database to import...

thanks!


Kodi

ChrisW67
24th March 2012, 23:22
When you construct your QSqlTableModel model you specify which database connection to use rather than the default option of it using the default connection.

mtnbiker66
25th March 2012, 00:08
Ah, jeez, that's embarrassing...I completely missed that in the documentation...It's amazing how something sticks out so glaringly when it's pointed out...I'll wipe the egg off my face and go open a new beer :)


Kodi