Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Creating a table with grid view adding, editing and deleting data from the MS SQL server using Qt Creator
Forum Updated to NodeBB v4.3 + New Features

Creating a table with grid view adding, editing and deleting data from the MS SQL server using Qt Creator

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
29 Posts 4 Posters 14.0k Views 2 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.
  • V Offline
    V Offline
    veera
    wrote on last edited by
    #18

    I want some examples how to do it using qt gui application...

    mrjjM 1 Reply Last reply
    0
    • V veera

      I want some examples how to do it using qt gui application...

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #19

      @veera
      That is how.
      Use delegate if you want the buttons being part of each row.
      The delegate is how u do it.

      It is not possible to do in Designer.

      1 Reply Last reply
      1
      • V Offline
        V Offline
        veera
        wrote on last edited by
        #20

        Hi All,
        i am using qt creator for adding ,save and delete the data from table ,here i am using QtTableview and i am not able to delete the particular row using push button method on qt and mssql server.......

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

          What code are you using currently to modify the content of the database ?

          Like stated before Qt Creator is just an IDE, you'll have to write a minimal amount of code to interact with your database.

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

          V 1 Reply Last reply
          1
          • SGaistS SGaist

            What code are you using currently to modify the content of the database ?

            Like stated before Qt Creator is just an IDE, you'll have to write a minimal amount of code to interact with your database.

            V Offline
            V Offline
            veera
            wrote on last edited by
            #22

            @SGaist
            for inserting the data
            query->prepare("INSERT INTO Entry2 (name,contact,lastname,id,emailid)" "VALUES(?,?,?,?,?)");
            showing the data after editing
            model->setQuery("SELECT *FROM Entry2");
            ui->tableView->setModel(model);
            for the same thing for deleting a particular row from the table?

            mrjjM 1 Reply Last reply
            0
            • V veera

              @SGaist
              for inserting the data
              query->prepare("INSERT INTO Entry2 (name,contact,lastname,id,emailid)" "VALUES(?,?,?,?,?)");
              showing the data after editing
              model->setQuery("SELECT *FROM Entry2");
              ui->tableView->setModel(model);
              for the same thing for deleting a particular row from the table?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #23

              @veera

              Hi
              Normally you will just use

              http://doc.qt.io/qt-5/qsqlquery.html#details

              and SQL.

              https://www.w3schools.com/sql/sql_delete.asp

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

                Why not use QSqlTableModel ?

                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
                0
                • V Offline
                  V Offline
                  veera
                  wrote on last edited by
                  #25

                  yeah i tried using QSqlTableModel ,here below code instead of passing row on model.setFilter ,need to pass from UI using pushbutton method whichever row i can delete using delete push button method in a generic way....
                  model.setTable("Entry");
                  model.setFilter("id = 1");
                  model.select();
                  if (model.rowCount() == 1) {
                  model.removeRows(0, 1);
                  model.submitAll();
                  }

                  1 Reply Last reply
                  0
                  • V Offline
                    V Offline
                    veera
                    wrote on last edited by
                    #26

                    Hi All,
                    I want to develop this type of grid view like after clicking edit button for each row of table please refer this link
                    "http://www.c-sharpcorner.com/uploadfile/1e050f/edit-and-update-record-in-gridview-in-asp-net/" .....guide me for implementing same grid view using Qt and MS Sql server.....

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      veera
                      wrote on last edited by
                      #27

                      Hi All,

                                 How can i use QML grid view for implementing my grid view control please any one  guide ....
                      
                      1 Reply Last reply
                      0
                      • V Offline
                        V Offline
                        veera
                        wrote on last edited by
                        #28

                        Hi
                        If anybody having the idea to implement grid view on QT 4.8 version and MS SQL Server (Ubuntu 16.04 LTS)........please share your ideas.........

                        1 Reply Last reply
                        0
                        • D Offline
                          D Offline
                          donaldante
                          Banned
                          wrote on last edited by
                          #29
                          This post is deleted!
                          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