Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [QSQLite] select returns all values as QString
Forum Updated to NodeBB v4.3 + New Features

[QSQLite] select returns all values as QString

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 687 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Flamaros
    wrote on last edited by
    #1

    I put some decimal values in a table and when I do my SELECT query value method return me a QVariant containing only string event for DECIMAL types.

    Here are my queries for creation, insertion and select :

    query.exec("create table Weight "
    "(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "
    "date DATE, "
    "morning DECIMAL, "
    "noon DECIMAL, "
    "evening DECIMAL, "
    "comment TEXT, "
    "recordDate DATETIME DEFAULT CURRENT_TIMESTAMP)");

    query.exec(QString("INSERT INTO Weight (date, morning, noon, evening, comment) VALUES ('%1', %2, %3, %4, '%5')") .arg(date).arg(morning).arg(noon).arg(evening).arg(comments[i]));

    query.exec(QString("SELECT date, morning, noon, evening, comment FROM Weight"));

    Is there a way to get my values in the corresponding types of table columns?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved