以下是我原封不动按您的代码来的,然后报错了,我找了好久都找不到原因,能否看一下呢,谢谢?
import os
import win32com.client
import os,sys,string
conn = win32com.client.Dispatch(r’ADODB.Connection’)
DSN = r’PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=SpiderResult.mdb;’
conn.Open(DSN)
print ‘connect ….’
rs=win32com.client.Dispatch(r’ADODB.Recordset’)
rs.Open(‘Select top 10 from 14021 ‘)
if rs.recordcount == 0:
sys.exit()
rs.MoveFirst()
print rs.recordcount
while not rs.EOF:
print rs.Fields.Item(3).Value
print ‘—————-‘
rs.MoveNext()
print “Record Count:”,rs.recordcount
rs.Close()
Traceback (most recent call last):
File “”, line 1, in
conn.Open(DSN)
File “”, line 3, in Open
File “C:\Python27\lib\site-packages\win32com\client\dynamic.py”, line 282, in _ApplyTypes_
result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes) + args)
com_error: (-2147352567, ‘\xb7\xa2\xc9\xfa\xd2\xe2\xcd\xe2\xa1\xa3′, (0, u’ADODB.Connection’, u’\u672a\u627e\u5230\u63d0\u4f9b\u7a0b\u5e8f\u3002\u8be5\u7a0b\u5e8f\u53ef\u80fd\u672a\u6b63\u786e\u5b89\u88c5\u3002′, u’C:\\Windows\\HELP\\ADO270.CHM’, 1240655, -2146824582), None)