当前位置:网站首页>Pymssql controls SQL for Chinese queries
Pymssql controls SQL for Chinese queries
2022-07-03 09:56:00 【CSDN Q & A】
The phenomenon and background of the problem
pymssql control SQL The result cannot be found during Chinese query , however SQL Statements in SSMS Results can be found in


Problem related code , Do not paste screenshots
import SQL_part
if name == 'main':
con,cur=SQL_part.ConDataBase()
print(SQL_part.Select_Plate(cur,' Wan A4K1PS'))

Test functions
def Select_Plate(cursor,plate):
sql = "SELECT * FROM LicensePlate where plate='%s'"%plate
cursor.execute(sql.encode('cp936'))
return cursor.fetchall()
Query function
SQL sentence
SELECT * FROM LicensePlate where plate=' Wan C45K23'
Operation results and error reporting contents
No error reported , But there was no expected result
My solution ideas and tried methods
Consider maybe SQL Coding Chinese problems , But another query function can get results normally , And in ssms in sql Statements can be run
What I want to achieve
Can get Chinese keyword query results
Take the answer :
Probability is a matter of character set , Please confirm the consistency of file code and character set .
in addition , Try to put cp936 Switch to cp65001, The one in front is ansi(GBK), The back is utf8
边栏推荐
- For new students, if you have no contact with single-chip microcomputer, it is recommended to get started with 51 single-chip microcomputer
- Raspberry pie installation SciPy
- 2021-01-03
- There is no shortcut to learning and development, and there is almost no situation that you can learn faster by leading the way
- 在三线城市、在县城,很难毕业就拿到10K
- MYSQL数据库底层基础专栏
- PIP references domestic sources
- Programming ideas are more important than anything, not more than who can use several functions, but more than the understanding of the program
- Runtime. getRuntime(). GC () and runtime getRuntime(). The difference between runfinalization()
- 应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机
猜你喜欢
C language enumeration type

Uniapp realizes global sharing of wechat applet and custom sharing button style

The cyclic shift of PUCCH in NR channel is generated by MATLAB

应用最广泛的8位单片机当然也是初学者们最容易上手学习的单片机

【男保姆式】教你打开第一个微信小程序

STM32 serial communication principle
![[graduation successful] [1] - tour [Student Management Information System]](/img/91/72cdea3eb3f61315595330d2c9016d.png)
[graduation successful] [1] - tour [Student Management Information System]
![Successful graduation [3]- blog system update...](/img/91/72cdea3eb3f61315595330d2c9016d.png)
Successful graduation [3]- blog system update...

UCI and data multiplexing are transmitted on Pusch (Part VI) -- LDPC coding

CEF下载,编译工程
随机推荐
单片机现在可谓是铺天盖地,种类繁多,让开发者们应接不暇
2.Elment Ui 日期选择器 格式化问题
numpy. Reshape() and resize() functions
JS基础-原型原型链和宏任务/微任务/事件机制
Hal library sets STM32 clock
Assignment to '*' form incompatible pointer type 'linkstack' {aka '*'} problem solving
Oracle database SQL statement execution plan, statement tracking and optimization instance
【男保姆式】教你打开第一个微信小程序
Fundamentals of Electronic Technology (III)_ Chapter 2 principle of amplification circuit__ Crystal triode and field effect triode
How does the memory database give full play to the advantages of memory?
开学实验里要用到mysql,忘记基本的select语句怎么玩啦?补救来啦~
编程思想比任何都重要,不是比谁多会用几个函数而是比程序的理解
Of course, the most widely used 8-bit single chip microcomputer is also the single chip microcomputer that beginners are most easy to learn
[22 graduation season] I'm a graduate yo~
Fundamentals of Electronic Technology (III)__ Fundamentals of circuit analysis__ Basic amplifier operating principle
Simple use of MySQL (addition, deletion, modification and query)
[untitled] proteus simulation of traffic lights based on 89C51 Single Chip Microcomputer
[male nanny style] teach you to open the first wechat applet
Mysql database underlying foundation column
Intelligent home design and development