Insert And Join In Access Database Using Pyodbc
I have a MS access DB and want to work with it from Python. The aim is to have a table, 'units', which includes everything and in order to achieve that I would like to insert infor
Solution 1:
pyodbc uses ?
as the parameter placeholder, not %s
, so your query string should be
mySql_insert_query='''INSERT INTO Units (client_id,client_first_name, … ) VALUES (?,?, … )'''
then you execute it with
cursor.execute(mySql_insert_query,recordTuple)
as before.
Solution 2:
It's the line
mySql_insert_query='''INSERT INTO Units (client_id,client_first_name,client_last_name,units_ordered,product_price_per_unit,product_name) VALUES (%s,%s,%s,%s,%s,%s)'''
You have no values for the %s parameter. Replace these with values as you do in the next line.
Also, I seriously doubt, that these fields should be text and not numbers:
units_ordered,product_price_per_unit
Post a Comment for "Insert And Join In Access Database Using Pyodbc"