Answer the question
In order to leave comments, you need to log in
How to insert data into pypyodbc SQL table?
I have a table like this:
And this is the code:
appr = int(input('Введите оценку: '))
mySQLQuery = (f'''
SELECT {subject}
FROM dbo.rating
insert into dbo.rating ({subject}) values ('{appr}')
''')
cursor.executemany(mySQLQuery)
Answer the question
In order to leave comments, you need to log in
Some kind of request you have is strange ... have you tried it separately? Add an id characteristic to auto_increment and see what happens
added a grade to an existing line
mySQLQuery = (f'''update dbo.rating set `{subject}` = {appr} where id = '{your_id}')''')
mySQLQuery = f'''update dbo.rating set `{subject}` = %s where id = %s'''
cursor.execute(mySQLQuery, (appr, your_id))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question