thecodemonkey86 / qt_mysql_driver

Typical symptom: QMYSQL driver not loaded. Solution: get pre-built Qt SQL driver plug-in required to establish a connection to MySQL / MariaDB using Qt. Download qsqlmysql.dll binaries built from official Qt source code
Other
417 stars 58 forks source link

parameter count mismatch #3

Closed icEngineer-tech closed 4 years ago

icEngineer-tech commented 4 years ago

I've seen your readme.md file but my driver is loaded successfully, I have a problem with "Parameter count mismatch". when I try to connect to my database, it's ok, but when I want to send data it shows that error I use PHPMyAdmin, you can find my project under: https://github.com/CppProgrammer23/QtProjects/tree/master/QMachine_Check_Up

thecodemonkey86 commented 4 years ago

Hi, db = QSqlDatabase::addDatabase("QSQLITE"); you are loading the SQLite driver, not the MySql driver

icEngineer-tech commented 4 years ago

hi there, MySql doesn't work, it shows me failed if I set it to MySql

thecodemonkey86 commented 4 years ago

i'm gonna need more information

icEngineer-tech commented 4 years ago

I'm using Qt 5.14.2, I use the C++17 compiler (MSVC2017), I use phpMyAdmin because I don't want to install Sql on my computer. The error is when I prepare the Query to send data to the db. The program execute line 161 instead of line 159 which shows me the error "Parameter count mismatch"

thecodemonkey86 commented 4 years ago

you should first check if qsr.prepare(...) returns true and if it returns false, show what qsr.lastError().text() says in that case

icEngineer-tech commented 4 years ago

yes it returns false, the message is : "Parameter count mismatch"

thecodemonkey86 commented 4 years ago

some more things to test

icEngineer-tech commented 4 years ago

it doesn't work; neither select nor create , also I tried "INSERT INTO mytab (operator_id, machine_id) VALUES (?, ?)" and same error

thecodemonkey86 commented 4 years ago

what is the error message if you don't use any parameters at all, i.e. select all rows

icEngineer-tech commented 4 years ago

"no query unable to fetch row"

thecodemonkey86 commented 4 years ago

if it's not too much to ask and your database doesn't contain any confidential information: could I get temporary read only access to it for further analysis?

icEngineer-tech commented 4 years ago

yes of course: check this: https://github.com/CppProgrammer23/QtProjects/blob/master/QMachine_Check_Up/Readme.md the readme.md: https://github.com/CppProgrammer23/QtProjects/tree/master/QMachine_Check_Up

thecodemonkey86 commented 4 years ago

the server doesn't accept connections from my IP address

thecodemonkey86 commented 4 years ago

probably database user privileges must be set accordingly. See https://dev.mysql.com/doc/refman/8.0/en/grant.html

thecodemonkey86 commented 4 years ago

seems to be abandoned and not really related to the driver anyway. Closing

Amarenko-prog commented 1 year ago

Hello I am getting error "Failed to create account. Parameter cont mismatch", can somebody help me here is my code: https://github.com/nttminh/ticket-booking-dashboard

thecodemonkey86 commented 1 year ago

Hi, probably not, unless you provide more information and post code here and as minimal reproducible example