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. I am trying to fetch data from Sqlite to Table but data is not showing in table
Forum Updated to NodeBB v4.3 + New Features

I am trying to fetch data from Sqlite to Table but data is not showing in table

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 119 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.
  • P Offline
    P Offline
    Pappu Kumar Keshari
    wrote on last edited by
    #1

    import QtQuick 2.7
    import QtQuick.Window 2.0
    import QtQuick.Controls 1.4

    Window
    {
    width: 700
    height: 500
    visible: true

    Component.onCompleted: {
        var query = "SELECT * FROM student";
        var result = d_bmanager.execQuery(query);
    
        for (var i = 0; i < result.length; i++) {
            myModel.append({
                               name: result[i].name,
                               fatherName: result[i].fatherName,
                               motherName: result[i].motherName
                           });
        }
    }
    
    TableView {
        id: myTable
        anchors.fill: parent
        anchors.margins: 5
    
        TableViewColumn {
            role: name
            title: "Name"
            width: 250
            horizontalAlignment: Text.AlignHCenter
        }
        TableViewColumn {
            role: fatherName
            title: "Father's Name"
            width: 250
            horizontalAlignment: Text.AlignHCenter
        }
        TableViewColumn {
            role: motherName
            title: "Mother's Name"
            width: 250
            horizontalAlignment: Text.AlignHCenter
        }
        model: myModel
    }
    

    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You have no error checks, no debug information added.
      Nothing there to even know whether your code does something.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

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