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. How to insert certain table_1 column value in table_2 along with QLineEdit values
Forum Updated to NodeBB v4.3 + New Features

How to insert certain table_1 column value in table_2 along with QLineEdit values

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 209 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.
  • L Offline
    L Offline
    Lalremruata
    wrote on last edited by
    #1

    I am stuck and request help. I have an Sqlite3 table and code with PyQt5 in PyCharm. I want to insert id's latest row of table_1 into a "import" column in table_2 simultaneously when a button is click to make new record for/in table_2. [Fetch table_1 id's latest row number and insert into "import" column along with name1 and name2 (user input) text value in table_2 when a button is click.]

    Table_1:
    CREATE TABLE "table_1" (
    "id" INTEGER UNIQUE,
    "first_name" TEXT,
    "last_name" TEXT,
    PRIMARY KEY("id" AUTOINCREMENT)
    )

    Table_2:
    CREATE TABLE "table_2" (
    "import" INTEGER,
    "name1" TEXT,
    "name2" TEXT
    )

    I have google many website but could not find clue/answer to my problem. There are some code to insert value(s) into another table but they missed out on how to insert into along with capturing the QlineEdit user's input values.

    Thanks in advance.

    Pl45m4P 1 Reply Last reply
    0
    • L Lalremruata

      I am stuck and request help. I have an Sqlite3 table and code with PyQt5 in PyCharm. I want to insert id's latest row of table_1 into a "import" column in table_2 simultaneously when a button is click to make new record for/in table_2. [Fetch table_1 id's latest row number and insert into "import" column along with name1 and name2 (user input) text value in table_2 when a button is click.]

      Table_1:
      CREATE TABLE "table_1" (
      "id" INTEGER UNIQUE,
      "first_name" TEXT,
      "last_name" TEXT,
      PRIMARY KEY("id" AUTOINCREMENT)
      )

      Table_2:
      CREATE TABLE "table_2" (
      "import" INTEGER,
      "name1" TEXT,
      "name2" TEXT
      )

      I have google many website but could not find clue/answer to my problem. There are some code to insert value(s) into another table but they missed out on how to insert into along with capturing the QlineEdit user's input values.

      Thanks in advance.

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by
      #2

      @Lalremruata said in How to insert certain table_1 column value in table_2 along with QLineEdit values:

      There are some code to insert value(s) into another table but they missed out on how to insert into along with capturing the QlineEdit user's input values.

      Just put them together. If you know how to retrieve the user input from QLineEdit and you know how to insert data to your database. There you go :)

      Have a look at value binding:

      • https://doc.qt.io/qt-5/sql-sqlstatements.html#inserting-updating-and-deleting-records

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      3

      • Login

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