How do I insert data into TallyERP using ODBC/pyodbc?

49 Views Asked by At

So the connection is working fine and I am able to read data with pyodbc. But when it comes writing data I get no error but the values do not get entered into TallyERP.

Here is the code:

import pyodbc

connection = pyodbc.connect('DSN=TallyODBC64_9000;SERVER=({local});DRIVER=Tally ODBC DRIVER64;PORT=9000')
cursor=connection.cursor()

try:
    query = "INSERT INTO StockItem ($StockItemName, $_ClosingRate, $Parent) VALUES ('Product', 200, 'Category')"
    cursor.execute(query)
    connection.commit()
except Exception as e:
    print(f"Error: {e}")

finally:
    cursor.close()
    connection.close()

I was expecting the data to get entered or give me an error. But I got no error and the data was not entered

0

There are 0 best solutions below