Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python sql help
#8
(Nov-18-2019, 07:50 PM)keuninkske Wrote:
def opvragenminimumstock(partnum):
    minimumstock = cursor1.execute("select columna from TABLEA where columnb = '"+ partnum +"'")
    print(minimumstock)
    pass

You should never be building queries by concatenating strings (the term to look up is "SQL injection"). Instead, you should be using the right placeholder character (which is apparently ?, according to the documentation.

In addition, that pass statement is unnecessary.
Reply


Messages In This Thread
python sql help - by keuninkske - Nov-17-2019, 07:48 PM
RE: python sql help - by Larz60+ - Nov-17-2019, 11:23 PM
RE: python sql help - by keuninkske - Nov-18-2019, 07:50 PM
RE: python sql help - by ndc85430 - Apr-05-2020, 02:21 PM
RE: python sql help - by SnoopFrogg - Nov-19-2019, 02:50 PM
RE: python sql help - by keuninkske - Nov-20-2019, 07:38 PM
RE: python sql help - by SnoopFrogg - Nov-20-2019, 10:36 PM
RE: python sql help - by keuninkske - Apr-05-2020, 01:39 PM
RE: python sql help - by keuninkske - Apr-05-2020, 05:52 PM

Forum Jump:

User Panel Messages

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