Reputation: 344
Having some issues inserting records from pyodbc
using sql
insert
.
The code runs and it also looks like MS Access table is generating an ID
but the records are not showing in the table.. No Errors in my application , first time using MS Access and pyodbc
to insert records. Maybe I need to allow or change setting in Access?
import pyodbc
conn = pyodbc.connect(r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;{FIL=MS Access};DriverId=25;DefaultDir=C:\Users\James\Documents;DBQ=C:\Users\James\Documents\Database1.accdb;')
cursor = conn.cursor()
def add_new_loancar_to_DB():
cursor = conn.cursor()
cursor.execute( "INSERT INTO Loan_vehicle_data (Loan_make , Loan_model , Loan_rego) values ('test' , 'test' , 'test')")
Upvotes: 0
Views: 134