Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Problem on database connection
Good evening, guys.
I'm developing a desktop program that have a form where the user insert all the required data and submit it to the SQL database.
The problem is that, after I fill the form with data, I need to submit it to the database, but, for some reason, it don't work. I've been following these references to develop the insert query:
My insert query is something like this: insert into paciente (nome,cpf,data_nascimento,identidade,registro_hospitalar,cns,procedencia,naturalidade,cor,endereco,nome_mae,responsavel,telefone_fixo,celular,email,cncdo,historia_clinica,nefroesclerose_hipertensiva,doenca_renal_cronica,nefropatia_diabetica,glomerulopatias,lupus_eritemaso_sistemico,doenca_urologica,doenca_cronica_enxerto,cardiorrenal,hepatorrenal,sindrome_nefrotica,doenca_policistica,causas_obstrutivas,mal_formacao_congenita,nao_se_aplica,insuficiencia_renal_aguda,grupo_sanguineo,fator_rh,medicamento,micropore,transpore,filme_transparente,outro,concentrado_de_hemacias,concentrado_de_plaquetas,plasma,usuario_id) values( COLOCAR UMA VARIAVEL PARA CADA VALOR A SER INSERIDO NO BANCO - OLHAR EXEMPLO )
Anyone reccomend me any reference to solve this issue?
Hi and welcome to devnet,
What exact error are you getting ?
What version of Qt are you using ?
What OS are you running ?
What database system are you using ?
what is not working for you ? When you click on the submit button, does it come to some slot(method) in your program. Check this. If yes, is DB insert is failing ? Are you able to connect to database ? Check this as well. If
I'm using the latest stable version o Qt for Windows 10. The database is MySQL.
This is the error message:
"cannot find -llibmysql
error: collect2: ld returned 1 exit status"
I'm developing this together with a friend and he has the latest version on his computer. As soon as he gets back from hollidays I'll post the error more detailed in here. Sorry for the gap of information and thanks for the support!
"cannot find -llibmysql
Are you adding the above library manually in the pro file ?
Are you trying to build the MySQL plugin ?
@dheerendra Yes, I added the library to the project directory.
There is no specific requirement to add the library to project file if you are using the MySQL. It is handled thru 'sql' module. If you are including the like this means that you are using mysql directly & not through Qt. Is that correct ?