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. Deleting row from MySQL database
Forum Updated to NodeBB v4.3 + New Features

Deleting row from MySQL database

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 5 Posters 6.6k 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.
  • V Offline
    V Offline
    veera
    wrote on 3 Mar 2017, 08:13 last edited by
    #7

    int type

    J 1 Reply Last reply 3 Mar 2017, 08:25
    0
    • V veera
      3 Mar 2017, 08:13

      int type

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 3 Mar 2017, 08:25 last edited by
      #8

      @veera Can you show the CREATE TABLE query you're using for the table where you're trying to insert int > 9digits?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      V 1 Reply Last reply 3 Mar 2017, 12:21
      0
      • V VRonin
        2 Mar 2017, 08:01

        what type is id in your database?

        V Offline
        V Offline
        veera
        wrote on 3 Mar 2017, 10:31 last edited by VRonin 3 Mar 2017, 11:12
        #9

        @VRonin said in Deleting row from MySQL database:

        what type is id in your database?

        int type only......

        1 Reply Last reply
        0
        • V Offline
          V Offline
          VRonin
          wrote on 3 Mar 2017, 11:19 last edited by
          #10

          int in MySQL goes from -2147483648 to 2147483647 (or from 0 to 4294967295 if unsigned) (ref: https://dev.mysql.com/doc/refman/5.7/en/integer-types.html) and same goes for a c++ int variable in most environments so it's only natural you can't use the majority of numbers with 10 digits.

          Use a BIGINT (qint64 in C++) to go to 18 digits or just use a string

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          V 1 Reply Last reply 3 Mar 2017, 12:29
          2
          • J jsulm
            3 Mar 2017, 08:25

            @veera Can you show the CREATE TABLE query you're using for the table where you're trying to insert int > 9digits?

            V Offline
            V Offline
            veera
            wrote on 3 Mar 2017, 12:21 last edited by
            #11

            @jsulm
            Here is my table
            CREATE TABLE entry (id INT,name NVARCHAR(200),contact_no INT,lastname NVARCHAR(200),emailid NVARCHAR(200));

            J 1 Reply Last reply 3 Mar 2017, 12:21
            0
            • V veera
              3 Mar 2017, 12:21

              @jsulm
              Here is my table
              CREATE TABLE entry (id INT,name NVARCHAR(200),contact_no INT,lastname NVARCHAR(200),emailid NVARCHAR(200));

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 3 Mar 2017, 12:21 last edited by
              #12

              @veera See explanation from @VRonin

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • V VRonin
                3 Mar 2017, 11:19

                int in MySQL goes from -2147483648 to 2147483647 (or from 0 to 4294967295 if unsigned) (ref: https://dev.mysql.com/doc/refman/5.7/en/integer-types.html) and same goes for a c++ int variable in most environments so it's only natural you can't use the majority of numbers with 10 digits.

                Use a BIGINT (qint64 in C++) to go to 18 digits or just use a string

                V Offline
                V Offline
                veera
                wrote on 3 Mar 2017, 12:29 last edited by
                #13

                @VRonin
                I am using MSSQL on ubuntu 16.04 LTS 64 bit
                after using qint64 instead of int in qtcreator application..... also samething is coming i.e 0 if i am inserting more than 10 digits....

                J 1 Reply Last reply 3 Mar 2017, 13:04
                0
                • V veera
                  3 Mar 2017, 12:29

                  @VRonin
                  I am using MSSQL on ubuntu 16.04 LTS 64 bit
                  after using qint64 instead of int in qtcreator application..... also samething is coming i.e 0 if i am inserting more than 10 digits....

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 3 Mar 2017, 13:04 last edited by
                  #14

                  @veera You need to change the data type of id in your database (BIGINT as @VRonin already said) , not just use qint64 in your code.
                  Why do you need such big numbers?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  1
                  • V Offline
                    V Offline
                    veera
                    wrote on 4 Mar 2017, 10:45 last edited by veera 3 Apr 2017, 10:46
                    #15

                    i want to store the mobile No is 10 digits so after declaring qint64 also same issue is coming ....

                    M 1 Reply Last reply 4 Mar 2017, 12:06
                    0
                    • V veera
                      4 Mar 2017, 10:45

                      i want to store the mobile No is 10 digits so after declaring qint64 also same issue is coming ....

                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 4 Mar 2017, 12:06 last edited by
                      #16

                      @veera
                      Hi
                      int contact_no = ui->lineEdit_3->text().toInt();

                      This is still int and limit in range

                      So you are looking at something like

                      bool ok;
                      QString input=ui->lineEdit_3->text();// take text
                      qint64 contact_no = input.toLongLong(&ok); // convert
                      if (!ok) {
                      error("invalid value");
                      return;
                      }
                      ..
                      Convert was ok, use.

                      1 Reply Last reply
                      4

                      16/16

                      4 Mar 2017, 12:06

                      • Login

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