# open database connection host here='. 'also can use the machine IP or IP + port number (essentially a default port number: 1433)
Conn=pymssql. Connect (host="J freight 330 \ hupeng", user="sa", "=" H * * * * g1980 ", the database="financial bottleneck in the database," charset='utf8')
# use the cursor () method to get your cursor
Cursor=conn. Cursor ()
SQL query statement #
SQL="SELECT * FROM test"
Try:
# executing SQL statements
Cursor. The execute (SQL)
# get all record list
Results=cursor. Fetchall ()
Print (results)
Except:
Print (results)
# close the database connection
Conn. Close ()
in accordance with the above code to run after an error the following problems:
Traceback (the most recent call last) :
The File "C:/Users/198189/PycharmProjects/untitled/learning. Py", line 14, the in & lt; module>
Conn=pymssql. Connect (host="J freight 330 \ hupeng", user="sa", "=" H * * * * g1980 ", the database="financial bottleneck in the database," charset='utf8')
File "SRC \ pymssql pyx", line 636, in pymssql. Connect
File "SRC \ _mssql pyx", line 1957, in _mssql. Connect
File "SRC \ _mssql pyx", line 653, in _mssql. MSSQLConnection. __init__
UnicodeEncodeError: 'ASCII' codec can 't encode characters in the position 0 to 7: ordinal not in range (128)
The Process finished with exit code 1
please everyone a great god help to solve the problem!!!
CodePudding user response:
Excuse me pymssql is this?CodePudding user response:
Connection is essentially had to use libraryCodePudding user response:
The