Questions tagged [qsqlquery]

The QSqlQuery class, part of the Qt framework, provides a means of executing and manipulating SQL statements.

QSqlQuery encapsulates the functionality involved in creating, navigating and retrieving data from SQL queries which are executed on a QSqlDatabase.

Documentation can be found here.

417 questions
0
votes
1 answer

How do I connect to my web domain's mySQL database using Qt?

I have a web domain and had already mySql database in it. I wish to connect and retrieve data from the database to my Qt Application. Here is my attempt and my result. (The host name, database name, username and password were just edited). …
Xegara
  • 563
  • 2
  • 10
  • 23
0
votes
2 answers

Writing a function in C++ with Qt

I know how to format functions in C++ for the most part, except for this scenario which I've never seen before. I currently have this: void MainWindow::on_viewEmployees_clicked() { QDebug debugTxt(QtDebugMsg); DatabaseControl myDBControl; //this is…
ozzymado
  • 960
  • 3
  • 15
  • 26
0
votes
1 answer

How to compare records and assign a value in sqlserver

i have two columns in my database "Name" and "Id" e.g. NAME | ID -----+----------- jhon | 0 -----+----------- kim | 0 -----+----------- alex | 0 -----+----------- jhon | 0 -----+----------- alex | 0 -----+----------- max |…
Arslan Tariq
  • 29
  • 1
  • 5
0
votes
0 answers

Why are all these QSqlQuery properties returning false?

I have setup a database like this, and confirmed that records are being added and read successfully from a table called "person": db = QSqlDatabase::addDatabase("QSQLITE"); db.setHostName("localhost"); …
johnbakers
  • 24,158
  • 24
  • 130
  • 258
0
votes
4 answers

how create select query to get all the child node of any particular node in tree structure db table

My Tree Structure is and the database table i have created is how create select query to get all the child node of any particular node in tree structure db table. for Example i pass superior_emp_id=1 then it return {2, 3, 4, 5, 6, 7}
java baba
  • 2,199
  • 13
  • 33
  • 45
0
votes
1 answer

isSelect QSqlQuery not working as expected

I have the following code: QString req = QString( "dbo.create_bsk @sico = " ) + QString(current_sico.c_str()) + ", @dev_cod='" + local_ccy.c_str() +"'"; QSqlQuery query = db.exec(req); std::cout << req.toStdString() << std::endl; std::cout <<…
user2346536
0
votes
4 answers

Insert Strings that contain “ ` ” or “ ' ” to the database table - Qt

I have to insert some strings to MySQL database. The problem is that every time I use " ` " or " ' " it causes errors in the QSqlquery execution. How can I prevent this?
elgolondrino
  • 665
  • 9
  • 33
0
votes
6 answers

What is the error in this SQL update stament

I have the method that do update to data base table but when I invoke it I have an exception "Incorrect syntax near '('." Here is the method internal Boolean update(int customerID,int followingID, string fullName, string idNumber, string address,…
Fadi Khalil
  • 291
  • 4
  • 8
  • 18
0
votes
2 answers

Best method of organizing database?

MORE DETAILS: Both of you recomend using JOIN. But the main problem is how to assign multiple SUBJECTS PER EACH CLASS without using multiple duplicate values. I will have ~200 de classes, with ~30 subjects per class. That means if 2 classes share…
Acelasi Eu
  • 914
  • 2
  • 9
  • 30
0
votes
1 answer

Query to get reposts from people the user is following

I have a table posts where all the posts by users are stored, the structure of this table is as follows | post_id | post_user | post_content | post_date | the users table is as follows | user_id | username | user_joined | user relationship table…
vikas devde
  • 11,691
  • 10
  • 35
  • 42
0
votes
1 answer

select from a table where the dates are different to tha dates in other table

I have some dates in a table and i need a query that the dates in the table are different to the second table, i am intenting with this: http://sqlfiddle.com/#!2/a1308/2 But it now works I need for example in the first…
Code Geas Coder
  • 1,839
  • 4
  • 23
  • 29
0
votes
1 answer

How to implement pagewise loading in MSAccess

In my application that using MSAccess as DB, I need to implement pagewise loading with sql query. I know how to load first 10 records, thats by SELECT TOP 10 * FROM Product ORDER BY dateAdded DESC But how can I pick record that is from 10 to…
Johnykutty
  • 12,091
  • 13
  • 59
  • 100
0
votes
1 answer

I can't get an Object from base using SQL natif Hibernate

I tried to follow an example of a book hibernate Chapter 17 SQL native so I summary, I would return an object XXX with a SQL query using Hibernate .. Here is my example @Override public Composant FindComposantFRomXls(String comp, String fab)…
Adriano_jvma
  • 455
  • 2
  • 11
  • 20
0
votes
1 answer

SQLite and QSqlQuery: Quoting bounded values

I want to get entries' date for a given month and year, for that I execute successfully in SQliteman the next query: SELECT date FROM Entries WHERE strftime('%Y-%m',date) = '2013-04' To use this query with QSqlQuery I use the following…
Manuel
  • 2,236
  • 2
  • 18
  • 28
0
votes
2 answers

qt select not working with where statement

I'm using qt 4.8 and psql driver to connect to a postgres 9.1 database. I'm doing a generic library to connect and insert into the database; almost all methods are ready but in the last one, I need to do a select from a table to insert values into…
Edgar Sampere
  • 263
  • 4
  • 24