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. Problem on database connection
Forum Updated to NodeBB v4.3 + New Features

Problem on database connection

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 955 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.
  • R Offline
    R Offline
    RKelviin
    wrote on 22 Dec 2018, 19:28 last edited by
    #1

    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:

    http://doc.qt.io/qt-5/sql-sqlstatements.html
    http://doc.qt.io/qt-5/sql-connecting.html

    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?
    Merry Christmas!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 22 Dec 2018, 19:36 last edited by
      #2

      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 ?

      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
      1
      • D Offline
        D Offline
        dheerendra
        Qt Champions 2022
        wrote on 23 Dec 2018, 08:51 last edited by
        #3

        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

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0
        • R Offline
          R Offline
          RKelviin
          wrote on 23 Dec 2018, 12:53 last edited by
          #4

          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!

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dheerendra
            Qt Champions 2022
            wrote on 23 Dec 2018, 17:06 last edited by
            #5

            @RKelviin said in Problem on database connection:

            "cannot find -llibmysql

            Are you adding the above library manually in the pro file ?

            Dheerendra
            @Community Service
            Certified Qt Specialist
            http://www.pthinks.com

            R 1 Reply Last reply 24 Dec 2018, 02:01
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 23 Dec 2018, 22:18 last edited by
              #6

              Are you trying to build the MySQL plugin ?

              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
              • D dheerendra
                23 Dec 2018, 17:06

                @RKelviin said in Problem on database connection:

                "cannot find -llibmysql

                Are you adding the above library manually in the pro file ?

                R Offline
                R Offline
                RKelviin
                wrote on 24 Dec 2018, 02:01 last edited by
                #7

                @dheerendra Yes, I added the library to the project directory.

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dheerendra
                  Qt Champions 2022
                  wrote on 24 Dec 2018, 04:42 last edited by
                  #8

                  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 ?

                  Dheerendra
                  @Community Service
                  Certified Qt Specialist
                  http://www.pthinks.com

                  1 Reply Last reply
                  0

                  1/8

                  22 Dec 2018, 19:28

                  • Login

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