By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,470 Members | 949 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,470 IT Pros & Developers. It's quick & easy.

SQL SELECT and INSERT work, but not UPDATE

P: 2
Using Python pyodbc

cursor.execute('SELECT CashBal , PlayerName from Balances where PlayerID = ?',83)
always works;
cursor.execute('UPDATE Balances Set CashBal = 123.0 Where PlayerID = ?',83)
fails, on 3-4 databases.
But this will work if I create a new, trivial database of one table with two columns and 10 records. i.e the syntax is correct. This suggests that there is an attribute of some databases I can not find. e.g they are not read-only.
I read about UPDATE problems with Windows 10, but not being an IT professional I cannot discern how to fix my problem.
What should I do?
Feb 19 '20 #1
Share this Question
Share on Google+
3 Replies

Expert Mod 10K+
P: 12,401
I looked up the instructions for pyodbc. It says you need to tell the connection to commit your changes. Otherwise they won't save. Either that or set the connection to autocommit.
Feb 19 '20 #2

P: 2
The commit command is present.
Feb 20 '20 #3

P: 110
The UPDATE statement ends normally even if the number of updates is 0.
Feb 21 '20 #4

Post your reply

Sign in to post your reply or Sign up for a free account.