Questions tagged [qtsql]

Questions related to QtSQl Module, a collection of Qt classes that work with various relational database management systems.

Provides a driver layer, SQL API layer, and a user interface layer for SQL databases.

238 questions
5
votes
1 answer

QTableView preserve selection after model refresh

I tried to build a user interface which displays the content of a table while the data is refreshed every second. Therefore I have a chain of models: QSqlTableModel - to access the tables content MyModel - inherited from QIdentityProxyModel to…
r2p2
  • 384
  • 4
  • 14
5
votes
1 answer

'EOMONTH' is not a recognized built-in function name- SQL Server 2012

I installed the SQL Server 2012- Developer edition. When I apply SELECT @@version, I get: Microsoft SQL Server 2005 - 9.00.5000.00 (Intel X86) Dec 10 2010 10:56:29 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on…
EverGreen
  • 75
  • 1
  • 1
  • 6
4
votes
1 answer

Qt: Example of QAbstractItemModel implementation using QtSql (to use with QTreeView)

I'm looking for an example implementation of QAbstractItemModel to use with QTreeView. The model should load data from QSqlQuery and should do it in a "lazy" way. In other words I only want to load records for nodes/parents that are open. And I'd…
user666491
4
votes
1 answer

QSql connect and read from Database example? - Driver not loaded

I've recently started found the need to change from the __mysql module to PyQt's QSql but have nooo idea whatsoever where to start. All I want to do (for now) is read from a database and print the results. This is the furthest I've gotten but I keep…
Jay
  • 3,373
  • 6
  • 38
  • 55
4
votes
2 answers

Qt - QSql Unable to fetch row, no query on attempt to insert

I'm trying to insert data into a table. Here's the code: void AddContacts::saveContact() { QString first_name = ui->lineFirstName->text(); QString last_name = ui->lineLastName->text(); QString street_address =…
JT White
  • 517
  • 4
  • 9
  • 21
4
votes
0 answers

QtSql: Capturing Event Notification for Changes in the SQLite DataBase

I have a SQLite database. I am trying to capture events on changes in the database in a Qt program that uses QtSql module, e.g., when a new record is inserted in a table from outside the Qt program. QSqlDatabase class offers a function to subscribe…
Jatala
  • 93
  • 1
  • 11
4
votes
2 answers

How to get numbers of rows and columns using QtSql?

I have read the Qt documentation and can't find a direct way from the language itself to get numbers of rows and columns from the query result. The only way I can think of is using SELECT COUNT(*) FROM table_name in mysql query itself. Like another…
Mas Bagol
  • 4,377
  • 10
  • 44
  • 72
4
votes
1 answer

How do I get my QTableView with QSqlTableModel to have checkboxes and multiline?

I need my QTableView that is rendering items using QSqlTableModel to have in a column checkboxes and to have in other columns multiline textEdits because I need new lines when the user presses the Enter button. It's a lot of stuff, but if I can get…
SubPrt
  • 43
  • 3
4
votes
1 answer

QSqlRelationalModel model/view update after changes

I've got a problem with updating model/view after changes. To explain better what I mean I wrote a simple example with SQLite. So the main.cpp file: #include #include "MainForm.h" void createConnection() { QSqlDatabase db =…
Daniel
  • 635
  • 1
  • 5
  • 22
4
votes
3 answers

QSqlQuery::exec: database not open

I'm working on qt, my database was rightly connected with qt but suddenly i have the following problem every time i debug,,,i i become not able to fetch or to add data from/to the database,,, i don't know whats's the matter but i'm new to qt.…
Nermeeno Alami
  • 69
  • 1
  • 4
  • 9
4
votes
1 answer

PyQt4: Display QtSql database in QTreeWidget

How would you display the contents of a QtSql table using a QTreeWidget? There isn't quite enough information around this particular subject...
user1006989
3
votes
2 answers

Qt QList serialization for database

I have a QList list. I want to insert it on the database. I didn't find any serializer method after some googling. If there any method / idea to serialize the list data for database?
Dewsworld
  • 13,367
  • 23
  • 68
  • 104
3
votes
1 answer

How to load ODBC in qt

I'm very new to Qt and C++ I'm trying to connect to an ODBC db, but I'm getting the following output QSqlDatabase: QODBC driver not loaded QSqlDatabase: available drivers: QSQLITE How do I load ODBC in Qt. CODE : QString serverName =…
asdasdasdasdqwe
  • 321
  • 1
  • 8
  • 20
3
votes
1 answer

Why does parameter count mismatch?

From what I gather it's a mistake in your database/query and I've tried the following in DB Browser for Sqlite and it works: UPDATE odgovori SET odgovor="1131" WHERE korisnik_ID="2" AND pitanje_ID="1"; INSERT INTO odgovori (korisnik_ID,…
3
votes
1 answer

Deploy Qt ODBC application

My application uses Qt SQL this way QSqlDatabase db = QSqlDatabase::addDatabase("QODBC"); db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};DBQ="+QDir::currentPath()+"/database.mdb"); and all the rest is done using…
yolo
  • 2,757
  • 6
  • 36
  • 65
1
2
3
15 16