当前位置:网站首页>sql语句模糊查询遇到的问题
sql语句模糊查询遇到的问题
2022-07-03 04:50:00 【CSDN问答】
问题遇到的现象和发生背景
sql语句模糊查询查不到数据
问题相关代码,请勿粘贴截图
StringBuilder sSelectSql =new StringBuilder( "select * from userInfo where 1=1"); List<SqlParameter> parameters = new List<SqlParameter>(); if (!string.IsNullOrEmpty(user.code)) { //根据用户账号精准查询 sSelectSql.Append(" AND [email protected]"); parameters.Add(new SqlParameter("@code", user.code)); } if (!string.IsNullOrEmpty(user.name)) { //模糊查询输入用户姓名 sSelectSql.Append(" AND [email protected]"); parameters.Add(new SqlParameter("@name", "%"+user.name+ "%")); }
运行结果及报错内容
账号查找可以实现,但是姓名查找查不到
我的解答思路和尝试过的方法
sql语句模糊查询格式不对吗
我想要达到的结果
求各位能人帮解决一下
边栏推荐
- 2022 P cylinder filling test content and P cylinder filling simulation test questions
- Market status and development prospect forecast of global button dropper industry in 2022
- The programmer went to bed at 12 o'clock in the middle of the night, and the leader angrily scolded: go to bed so early, you are very good at keeping fit
- Market status and development prospect forecast of global heat curing adhesive industry in 2022
- C primre plus Chapter 10 question 6 inverted array
- 【PHP漏洞-弱类型】基础知识、php弱相等、报错绕过
- @RequestMapping
- M1 Pro install redis
- 【SQL注入】联合查询(最简单的注入方法)
- 【XSS绕过-防护策略】理解防护策略,更好的绕过
猜你喜欢
Employee attendance management system based on SSM
Keepalived热备与HAProxy
【XSS绕过-防护策略】理解防护策略,更好的绕过
String matching: find a substring in a string
Thesis reading_ ICD code_ MSMN
Php+mysql registration landing page development complete code
Leetcode simple problem delete an element to strictly increment the array
[tools run SQL blind note]
Symbol of array element product of leetcode simple problem
The programmer went to bed at 12 o'clock in the middle of the night, and the leader angrily scolded: go to bed so early, you are very good at keeping fit
随机推荐
移动端——uniapp开发记录(公共请求request封装)
MySQL winter vacation self-study 2022 12 (3)
[set theory] binary relation (example of binary relation on a | binary relation on a)
JDBC database operation
[USACO 2009 Dec S]Music Notes
FISCO bcos zero knowledge proof Fiat Shamir instance source code
Review the old and know the new: Notes on Data Science
2022 registration examination for safety production management personnel of hazardous chemical production units and examination skills for safety production management personnel of hazardous chemical
[set theory] binary relationship (binary relationship notation | binary relationship from a to B | number of binary relationships | example of binary relationship)
《牛客刷verilog》Part II Verilog进阶挑战
Current market situation and development prospect forecast of global UV sensitive resin 3D printer industry in 2022
SSM based campus part-time platform for College Students
Market status and development prospect prediction of the global autonomous hybrid underwater glider industry in 2022
Market status and development prospect prediction of the near infrared sensor industry of the global Internet of things in 2022
LVS load balancing cluster of efficient multi-purpose cluster (NAT mode)
[luatos sensor] 2 air pressure bmp180
Market status and development prospect prediction of global fermented plant protein industry in 2022
Summary of training competition (Lao Li's collection of questions)
Handling record of electric skateboard detained by traffic police
[luatos sensor] 1 light sensing bh1750