Unsolved Deleting row from MySQL database
-
what type is
id
in your database? -
int type
-
@veera Can you show the CREATE TABLE query you're using for the table where you're trying to insert int > 9digits?
-
@VRonin said in Deleting row from MySQL database:
what type is
id
in your database?int type only......
-
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
-
@jsulm
Here is my table
CREATE TABLE entry (id INT,name NVARCHAR(200),contact_no INT,lastname NVARCHAR(200),emailid NVARCHAR(200)); -
-
@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.... -
-
i want to store the mobile No is 10 digits so after declaring qint64 also same issue is coming ....
-
@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.