Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database input by user
#10
i have 2 problems with the code below:

although Client, Models, etc., defined as TEXT, while entering values in text, the program crash. but if i enter numbers, it continue.

the other problem is, after entering the data (using the input), i get this error message:

Output:
client: 56 model: 45 quantity: 345 order date: 345 Delivery date: 45 Traceback (most recent call last): File "/Users/davidfrucht/PycharmProjects/untitled1/DFSL.py", line 22, in <module> dynamic_data_entry() File "/Users/davidfrucht/PycharmProjects/untitled1/DFSL.py", line 18, in dynamic_data_entry (client, model, quantity, order_date, delivery_date)) sqlite3.OperationalError: no such table: orders Process finished with exit code 1
here is the code

import sqlite3

conn = sqlite3.connect('dfsl.db')
c = conn.cursor()

def create_table():
    c.execute("CREATE TABLE orders (Client TEXT, Model TEXT, Quantity INTEGER, Order_date TEXT, Delivery_date TEXT)")

def dynamic_data_entry():
    client = input("client: ")
    model = input("model: ")
    quantity = input("quantity: ")
    order_date = input("order date: ")
    delivery_date = input("Delivery date: ")

    c.execute("INSERT INTO orders (Client, Model, Quantity, Order_date, Delivery_date) VALUES (?, ?, ?, ?, ?)",
              (client, model, quantity, order_date, delivery_date))

    conn.commit()

dynamic_data_entry()

conn.close()
Reply


Messages In This Thread
Database input by user - by D_frucht - May-17-2018, 01:14 PM
RE: Database input by user - by Larz60+ - May-17-2018, 01:29 PM
RE: Database input by user - by D_frucht - May-17-2018, 01:40 PM
RE: Database input by user - by Larz60+ - May-17-2018, 03:12 PM
RE: Database input by user - by buran - May-17-2018, 03:31 PM
RE: Database input by user - by D_frucht - May-17-2018, 04:07 PM
RE: Database input by user - by buran - May-17-2018, 04:13 PM
RE: Database input by user - by Larz60+ - May-17-2018, 04:15 PM
RE: Database input by user - by D_frucht - May-17-2018, 06:58 PM
RE: Database input by user - by buran - May-18-2018, 06:12 AM
RE: Database input by user - by D_frucht - May-18-2018, 06:22 AM
RE: Database input by user - by buran - May-18-2018, 06:28 AM
sqlite - input by user - by D_frucht - May-17-2018, 09:49 PM
RE: sqlite - input by user - by killerrex - May-17-2018, 10:06 PM
RE: sqlite - input by user - by D_frucht - May-17-2018, 10:20 PM
RE: sqlite - input by user - by woooee - May-18-2018, 12:18 AM
RE: sqlite - input by user - by D_frucht - May-18-2018, 04:42 AM
weird sqlite 3 in problem - by D_frucht - May-18-2018, 05:24 AM
RE: weird sqlite 3 in problem - by j.crater - May-18-2018, 05:38 AM
RE: weird sqlite 3 in problem - by D_frucht - May-18-2018, 05:38 AM
RE: weird sqlite 3 in problem - by j.crater - May-18-2018, 05:41 AM
RE: weird sqlite 3 in problem - by D_frucht - May-18-2018, 05:45 AM
RE: weird sqlite 3 in problem - by buran - May-18-2018, 06:07 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  WHILE LOOP NOT RETURNING USER INPUT AFTER ZerroDivisionError! HELP! ayodele_martins1 7 1,324 Oct-01-2023, 07:36 PM
Last Post: ayodele_martins1
  restrict user input to numerical values MCL169 2 1,075 Apr-08-2023, 05:40 PM
Last Post: MCL169
  user input values into list of lists tauros73 3 1,238 Dec-29-2022, 05:54 PM
Last Post: deanhystad
Information How to take url in telegram bot user input and put it as an argument in a function? askfriends 0 1,272 Dec-25-2022, 03:00 PM
Last Post: askfriends
Question Take user input and split files using 7z in python askfriends 2 1,263 Dec-11-2022, 07:39 PM
Last Post: snippsat
Sad how to validate user input from database johnconar 3 2,163 Sep-11-2022, 12:36 PM
Last Post: ndc85430
  How to split the input taken from user into a single character? mHosseinDS86 3 1,308 Aug-17-2022, 12:43 PM
Last Post: Pedroski55
  Use pexpect to send user input alisha17 0 2,100 May-10-2022, 02:44 AM
Last Post: alisha17
  WHILE Loop - constant variables NOT working with user input boundaries C0D3R 4 1,630 Apr-05-2022, 06:18 AM
Last Post: C0D3R
  Matplotlib - close multple plots with user input Positron79 0 1,846 Dec-01-2021, 05:26 PM
Last Post: Positron79

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020