Isaiah Melendez
asked on
Python 3.5.2 - SQL Update query error
Hello, Experts,
Running into an issue with my python script erroring out when grabbing input from end-user and passing it to the SQL update command then executing.
Can you help me figure out what is wrong?
CODE:
ERROR:
Running into an issue with my python script erroring out when grabbing input from end-user and passing it to the SQL update command then executing.
Can you help me figure out what is wrong?
CODE:
def option_two():
getCIM = int(input('Enter a store CIM number you want to edit:'))
print('')
print('You entered %s' % getCIM)
print('')
getstore_UIN = input('Enter the UIN you want to update for the the CIM you entered:')
print('')
print('You have successfully updated the store information database for')
#create connection ODBC driver
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER={test};DATABASE={ROWStage};UID={test};PWD={test123}')
cursor = cnxn.cursor()
#variables that grab user input variables and passes them to SQL command
store_UIN = getstore_UIN
store_CIM = getCIM
SQLCommand = ("UPDATE StoreInfo SET store_UIN = ? WHERE store_CIM = ?", store_UIN, store_CIM)
#store_UIN, store_Num, store_FileName, store_Name, store_CIM, store_OpeningDate, store_Email, store_Bays, store_Operator,
#store_Phone, store_Market, franchisee_Email, store_Street, store_City, store_State, store_Zip
#("UPDATE progress SET CockpitDrill = ? WHERE progress_primarykey = ?", newcockpitdrillvalue, oldprimarykeyvalue)
#stores getcim variable into a readable variable list
cursor.execute(SQLCommand, [store_UIN])
#commit the sql command
cnxn.commit()
input('Press enter to exit program')
ERROR:
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did in fact make a mistake in the code.