(1.3) By Sob Joker (JokerSob) on 2021-07-27 20:37:53 edited from 1.2 [link] [source]Deleted
(2) By Dan Kennedy (dan) on 2021-07-17 14:25:48 in reply to 1.1 [link] [source]
"IN" is a keyword. I think you'll need to call the column something else.
Can you see the error message from SQLite? It should have said as much.
(3.3) By Sob Joker (JokerSob) on 2021-07-27 20:36:32 edited from 3.2 in reply to 2 [link] [source]Deleted
(4) By Larry Brasfield (larrybr) on 2021-07-17 18:52:03 in reply to 3.2 [source]
1-) (NAME, PHONE, COMPANY, PERSON, EXPLANATION, CARD_NO, DATE, GIRIS_SAATI, CIKIS_SAATI) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
The error I get when I do is: sqlite3.OperationalError: 10 values for 9 columns
That's because your INSERT only named 9 columns to receive values but provided 10 values. I think you need to read these error messages more carefully.
(5.1) By Sob Joker (JokerSob) on 2021-07-27 20:36:41 edited from 5.0 in reply to 4 [link] [source]Deleted
(6) By Keith Medcalf (kmedcalf) on 2021-07-17 21:44:13 in reply to 5.0 [link] [source]
What does the error message say? Have you read it?
(7.2) By Sob Joker (JokerSob) on 2021-07-27 20:36:55 edited from 7.1 in reply to 6 [link] [source]Deleted
(8) By Keith Medcalf (kmedcalf) on 2021-07-17 22:25:14 in reply to 7.0 [link] [source]
And still I have not seen the error message, other than the message that the number of values does not match the number of parameters. Now you seem to have fixed that problem by (as commanded by the error message) making the number of parameters equal to the number of values.
Now you claim to have yet another different problem.
It is also likely that the error message will tell you EXACTLY what you have done wrong, and EXACTLY what circumstance will correct the error. Have you read the error message? Do you even know what the purpose of an error message is (hint -- it may be to tell you that YOU have made an error that YOU need to correct).
Until you report the error message you are seeing there can be no help for you.
(10) By Keith Medcalf (kmedcalf) on 2021-07-17 22:29:36 in reply to 8 [link] [source]
You will note that even your ORIGINAL posting did not state what error message you were receiving, nor where you received it. Merely that you were "having some" and you did not know what to do.
The answer you SHOULD have been given was:
(a) read the error message
(b) fix your error that caused the message to appear
It was a guessing game to determine what YOUR problem was THAT YOU CREATED FOR YOURSELF BY NOT PAYING ATTENTION TO ERROR MESSAGES.
If you do not report the actual error message received together with the exact SINGLE LINE on which the error occurred, there can be no help for you.
(9.1) By Ryan Smith (cuz) on 2021-07-17 22:27:45 edited from 9.0 in reply to 3.2 [link] [source]
cur.execute( "INSERT INTO Visitors (NAME, PHONE, COMPANY, PERSON, EXPLANATION, CARD_NO, DATE, GIRIS_SAATI, CIKIS_SAATI, ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL)", (VisitorsName, VisitorsPhone, VisitorsCompany, VisitorsPersonDepartment, VisitorsExplanation, VisitorsCardNo, VisitorsDate, VisitorsIn, VisitorsOut) )
(11.1) By Sob Joker (JokerSob) on 2021-07-27 20:37:14 edited from 11.0 in reply to 9.1 [link] [source]Deleted
(12) By Ryan Smith (cuz) on 2021-07-17 22:54:34 in reply to 11.0 [link] [source]
Those are wrapper errors in the wrapper (interface) you use, it's not SQLite errors.
I should think the Pyqt5 forum or usergroup should be able to shed some light on it.
With the error you get I would assume that "VisitorName" (which seems to be a string/text) is being pushed into a column that isn't so dedicated - not that SQLite would care about it, but the interface (wrapper) you use in Pyqt5 might care.
Do you have the database schema? Show how the table was created and we may perhaps have more thoughts, but honestly, you are far more likely to find help from the Pyqt5 people.
(14.2) By Sob Joker (JokerSob) on 2021-07-27 20:37:21 edited from 14.1 in reply to 12 [link] [source]Deleted
(13) By Keith Medcalf (kmedcalf) on 2021-07-17 23:09:56 in reply to 11.0 [link] [source]
That would indicate that the "type" of binding paramter 0 (the first one) (that is VisitorsName) is not a "type" that is recognized by the Python sqlite3.py wrapper.
The wrapper only recognizes the following native Python types:
- unicode text (str)
- integer (or long in py2)
- bytearray/bytes/or other blob (buffer protocol conforming) type
You need to look at the
type(VisitorsName) and ensure that the reported type is one recognized by the sqlite3.py wrapper natively (listed above), or is one for which there exists either a prepare_protocol or other adapter registered.
(15) By Keith Medcalf (kmedcalf) on 2021-07-17 23:25:53 in reply to 13 [link] [source]
The documentation for PyQt5 states that the .text() method on (what I presume) is an appropriate qt widget returns a
QString. This object type is not recognized by sqlite3.py hence you get an error message telling you that you have used an "unsupported type" since only native Python types (unicode/str/int/long/float/None/buffer) are "supported" and the type you have used (QString) has no converter/adapter/protocol registered to transform it to/from a standard supported type.
(16.3) By Sob Joker (JokerSob) on 2021-07-27 20:37:39 edited from 16.2 in reply to 13 [link] [source]Deleted
(17) By Simon Slavin (slavin) on 2021-07-18 12:48:15 in reply to 16.1 [link] [source]
Your problem is with Python, not SQLite. The things you're doing work fine in SQLite. You will get better help asking in a Python forum.