import win32com.client
engine = win32com.client.Dispatch("DAO.DBEngine.35")
db = engine.OpenDatabase(r"c:/temp/mydb.mdb")
rs = db.OpenRecordset("customers")
db.Execute("delete * from customers where balancetype = 'overdue' and name = 'bull'")
報錯:
E:\Python_Project\pythoncode\venv\Scripts\python.exe E:/Python_Project/pythoncode/example_pywin32.py
Traceback (most recent call last):
File "E:\Python_Project\pythoncode\venv\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch
IDispatch = pythoncom.connect(IDispatch)
pywintypes.com_error: (-2147221005, '無效的類字串', None, None)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/Python_Project/pythoncode/example_pywin32.py", line 6, in <module>
engine = win32com.client.Dispatch("DAO.DBEngine.35")
File "E:\Python_Project\pythoncode\venv\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "E:\Python_Project\pythoncode\venv\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "E:\Python_Project\pythoncode\venv\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
pywintypes.com_error: (-2147221005, '無效的類字串', None, None)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/159653.html
上一篇:大資料的簡要介紹
下一篇:Linux中JDK安裝部署
