Python Forum
Unable to read update access DB
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to read update access DB
#1
Access DB - Table Name - EMPTBL

Coloumns Names
Sal(with Values),cca(No Values),Hra(No Values),NS(No Values),GS(No Values)

I want to calculate CCA HRA NS GS, based on sal(salary)
and update the table EMPTBL

import pyodbc

conn = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\MyPython\Mydb.accdb;')
cursor = conn.cursor()
Mysal= cursor.execute('select sal from EMPTBL')

if Mysal > 5000:

sql= """ Update EMPTBL SET sal=mysal*.25"""
cursor.execute(sql)
cursor.commit()
conn.close()
Error:
File "C:/MyPython/MyTest.py", line 9 sql= """ Update EMPTBL SET sal=mysal*.25""" ^ IndentationError: expected an indented block Process finished with exit code 1
Reply


Messages In This Thread
Unable to read update access DB - by saaketh - Sep-23-2019, 03:54 PM
RE: Unable to read update access DB - by Malt - Sep-24-2019, 11:37 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to read csv file update matplotlib column chart regularly SamLiu 2 1,166 Jan-21-2023, 11:33 PM
Last Post: SamLiu
  |SOLVED] Glob JPGs, read EXIF, update file timestamp? Winfried 5 2,648 Oct-21-2021, 03:29 AM
Last Post: buran
  Unable to access jarfile Rakshan 2 2,777 Jul-28-2021, 11:10 AM
Last Post: Rakshan
  Unable to access the user input value given to daterangepicker klllmmm 1 2,376 May-26-2021, 09:16 PM
Last Post: nilamo
Question Python + Google Sheet | Best way to update specific cells in a single Update()? Vokofe 1 2,812 Dec-16-2020, 05:26 AM
Last Post: Vokofe
  Unable to Update SQLite Table sambanerjee 5 3,079 Sep-30-2020, 12:21 PM
Last Post: Larz60+
  Unable to read from serial port br0kenpixel 1 2,596 Aug-08-2020, 10:03 PM
Last Post: Larz60+
  unable to update packages russianponchik 0 1,714 Mar-29-2020, 04:18 PM
Last Post: russianponchik
  Unable to read decimal datatype using pandasql geethchi 0 2,132 Oct-25-2019, 05:56 PM
Last Post: geethchi
  Passing Values of Dictionaries to Function & Unable to Access Them firebird 3 2,689 Aug-03-2019, 10:25 PM
Last Post: firebird

Forum Jump:

User Panel Messages

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