15九月
2010
#!/usr/bin/python
#write by [email protected]
#快速對mdb執行sql操作
# coding=utf-8
import os
import random
import win32com.client
import time
import shutil
#資料庫路徑,注意末尾帶;
mdbpath = 「ff.mdb;」;
#根據內容更新資料庫,中文產品名和英文產品名暫時一樣
conn = win32com.client.dispatch(r』adodb.connection』);
dsn = 『provider=microsoft.jet.oledb.4.0;data source=』 + mdbpath;
sql_statement = 「update book set struser=』44′ where text_a=』119′ and struser=』42′」;
conn.open(dsn);
conn.execute(sql_statement);
conn.close();
print 「update db success」;
python 對ACCESS資料庫操作封裝模組
coding utf 8 by adengou 2016 01 02 programe python3.4.4 import os import json import win32com.client access資料模組 class access model def init self,datau...
Python操作Access資料庫
常用方法是使用pyodbc庫。import pyodbc dbfile r h xiaonei xnzy.accdb 資料庫檔案 conn pyodbc.connect r driver dbq dbfile uid pwd charset utf 8 用charset設定字符集 cursor co...
Python訪問Access資料庫
內容 利用win32com.client 模組的com元件訪問功能,通過adodb訪問access的mdb檔案 獲取connection物件 conn win32com.client.dispatch adodb.connection 設定connectionstring conn.connecti...