Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. German
  4. SQL-Tabelle AUTO_INCREMENT-Wert abfragen
Forum Updated to NodeBB v4.3 + New Features

SQL-Tabelle AUTO_INCREMENT-Wert abfragen

Scheduled Pinned Locked Moved Solved German
4 Posts 3 Posters 629 Views
  • 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.
  • G Offline
    G Offline
    GreatRookie
    wrote on last edited by
    #1

    Hallo allerseits!

       QSqlQuery query("SHOW TABLE STATUS LIKE 'tblBlaBlaBla'");
        queryNewNumber = query;
        queryNewNumber.first();
        intAutoIncr = queryNewNumber.value(0).toInt();
    

    Kriege 0 als intAutoIncr-Wert!

    Die Abfrage funktioniert in SQL einwandfrei.

    Was mache ich hier falsch?

    Besten Dank im Voraus!

    JonBJ 1 Reply Last reply
    0
    • G GreatRookie

      Hallo allerseits!

         QSqlQuery query("SHOW TABLE STATUS LIKE 'tblBlaBlaBla'");
          queryNewNumber = query;
          queryNewNumber.first();
          intAutoIncr = queryNewNumber.value(0).toInt();
      

      Kriege 0 als intAutoIncr-Wert!

      Die Abfrage funktioniert in SQL einwandfrei.

      Was mache ich hier falsch?

      Besten Dank im Voraus!

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @GreatRookie said in SQL-Tabelle AUTO_INCREMENT-Wert abfragen:

      Ergebnis aus queryNewNumber.first();?

      G 1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @GreatRookie said in SQL-Tabelle AUTO_INCREMENT-Wert abfragen:

        Was mache ich hier falsch?

        Du führst das Query nicht aus, abgesehen davon - warum kopierst Du das query überhaupt?

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        1
        • JonBJ JonB

          @GreatRookie said in SQL-Tabelle AUTO_INCREMENT-Wert abfragen:

          Ergebnis aus queryNewNumber.first();?

          G Offline
          G Offline
          GreatRookie
          wrote on last edited by GreatRookie
          #4

          Ok ich schreibe es für den Herrn Ehrlicher so um:

             QSqlQuery query("SHOW TABLE STATUS LIKE 'tblBlaBlaBla';");    //query wird inizialisiert - ausgeführt
             query.first();
             intAutoIncr = query.value(0).toInt();
          

          Mein Fehler:

              intAutoIncr = query.value(10).toInt();
          

          liefert erwartetes Ergebnis...

          1 Reply Last reply
          0

          • Login

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