# databasetest. Py
The import pyodbc
The db=pyodbc. Connect (r 'DRIVER={Microsoft Access DRIVER (*. MDB, *. Accdb)}; DBQ=D: \ \ CODE \ \ \ \ YOLOV3 YOLOV3-1 \ \ DATA \ \ database1 MDB ') # connection. The MDB file
Cursor=the cursor (#) to obtain a handle
# to create table users
Cursor. The execute (" CREATE TABLE users (ID VARCHAR (12), the name VARCHAR, the location VARCHAR, num INT) ")
# query data in the users table
Print ([I for I cursor in the execute (" SELECT * from the users WHERE ID='19010015385' ")]) # query specified data
# submit data (only after submission, all the operations will only take effect)
MIT ()
cursor.com# close handles
Cursor. The close ()
The close ()
Results operation error:
Traceback (the most recent call last) :
The File "databasetest. Py", line 11, the in & lt; module>
The db=pyodbc. Connect (r 'DRIVER={Microsoft Access DRIVER (*. MDB, *. Accdb)}; DBQ=D: \ \ CODE \ \ \ \ YOLOV3 YOLOV3-1 \ \ DATA \ \ database1 MDB ') # connection. The MDB file
Pyodbc. InterfaceError: (' IM002 ', '[IM002] [Microsoft] [ODBC driver manager] did not find the data source name and did not specify a default driver (0) (SQLDriverConnect)')

But my driver has been installed and configured, don't know how to change now,
Query driver is installed

In the ODBC data source management program can see

I'm also a user DSN and corresponding data sources are configured in the system DSN database

This was still in a fault, I should how to change ah

CodePudding user response:
Okay, I understand,,,,,,,,,,, wrong in I shouldn't build a new table