64-bit read access database under win10 python

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_45614899/article/details/100590067

Platform: win10,64 bit pycharm, python3, AccessDatabaseEngine_X64, pywin32-221.win- amd64-py3.7.
Tips: 64-bit systems must maintain consistency 64. Code directly show rough process, easy to understand, pro-test may be run, the system need not be provided ODBC64 bit data source.
Resources: link: https: //pan.baidu.com/s/1TxT5bng3P2FUYW5nojA6uQ
extraction code: uwd3.

win32com.client Import
# loading drive, modify the path itself
Conn = win32com.client.gencache.EnsureDispatch ( 'ADODB.Connection')
the DSN = 'the PROVIDER = Microsoft.ACE.OLEDB.12.0; D = the SOURCE the DATA: / Test / hbzh2005. the MDB; '
conn.Open (the DSN)
RS = win32com.client.Dispatch (r'ADODB.Recordset')
# access a local database table, a total of 516 lines of data
rs_name = "Reservoir"
rs.Open ( '[' + rs_name + ']', Conn,. 1,. 3)
rs.MoveFirst ()
COUNT = 0
the while True:
IF rs.EOF:
BREAK
the else:
COUNT = COUNT +. 1
rs.MoveNext ()
conn.Close ()
Print (COUNT)
Here Insert Picture Description
Here Insert Picture Description

Guess you like

Origin blog.csdn.net/qq_45614899/article/details/100590067