当前位置:网站首页>模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
模糊查詢時報錯Parameter index out of range (1 > number of parameters, which is 0)
2022-07-03 02:56:00 【一尾流鳶cd】
以下為報錯信息
select * from user where uid like '%?%'
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.PreparedStatement.checkBounds(PreparedStatement.java:3288)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3272)
at com.mysql.jdbc.PreparedStatement.setInternal(PreparedStatement.java:3314)
at com.mysql.jdbc.PreparedStatement.setInt(PreparedStatement.java:3258)
at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:3533)
預編譯賦值可能出現的錯誤:
- 指定的賦值比特置錯誤,即
parameterIndex參數錯誤,此參數的值是從1開始- 賦值數量不够
在保證sql語句沒有錯誤,且使用預編譯賦值無錯誤的情况下:
…
有可能是sql語句中使用的字符拼接方式不正確,小編就是這樣,剛開始使用單引號發生上面所述的异常。
解决方法:
改變sql語句的拼接方式,小編改成了select * from user where uid like concat('%',?,'%')
边栏推荐
- Build a private cloud disk cloudrev
- Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
- sql server数据库添加 mdf数据库文件,遇到的报错
- Installation and use of memory leak tool VLD
- [shutter] monitor the transparency gradient of the scrolling action control component (remove the blank of the top status bar | frame layout component | transparency component | monitor the scrolling
- Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
- 当lambda没有输入时,是何含义?
- Thunderbolt Chrome extension caused the data returned by the server JS parsing page data exception
- The process of connecting MySQL with docker
- [shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
猜你喜欢

I2C subsystem (IV): I2C debug

Kubernetes family container housekeeper pod online Q & A?
![[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)](/img/65/c1fe95f8c391394f7ff1b75c7d75b6.jpg)
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)

Kubernetes family container housekeeper pod online Q & A?
![[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)](/img/6e/67bc187a89fb9125856c78c89f7bfb.gif)
[shutter] bottom navigation bar page frame (bottomnavigationbar bottom navigation bar | pageview sliding page | bottom navigation and sliding page associated operation)
![[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)](/img/04/88ce45d370a2e6052c2fce558aa531.jpg)
[flutter] example of asynchronous programming code between future and futurebuilder (futurebuilder constructor setting | handling flutter Chinese garbled | complete code example)

Baidu map - surrounding search

Add automatic model generation function to hade

How to change the panet layer in yolov5 to bifpn

【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)
随机推荐
How to limit the size of the dictionary- How to limit the size of a dictionary?
The Linux server needs to install the agent software EPS (agent) database
MUX VLAN Foundation
Kubernetes cluster log and efk architecture log scheme
[error record] the parameter 'can't have a value of' null 'because of its type, but the im
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 2)
I2C 子系統(四):I2C debug
How to select the minimum and maximum values of columns in the data table- How to select min and max values of a column in a datatable?
random shuffle注意
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
Super easy to use logzero
从C到Capable-----利用指针作为函数参数求字符串是否为回文字符
左值右指解释的比较好的
Today, it's time to copy the bottom!
xiaodi-笔记
How to use asp Net MVC identity 2 change password authentication- How To Change Password Validation in ASP. Net MVC Identity 2?
[translation] modern application load balancing with centralized control plane
[translation] the background project has joined the CNCF incubator