当前位置:网站首页>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语句模糊查询格式不对吗
我想要达到的结果
求各位能人帮解决一下
边栏推荐
- Php+mysql registration landing page development complete code
- SSM based campus part-time platform for College Students
- Matplotlib -- save graph
- 4 years of experience to interview test development, 10 minutes to end, ask too
- Pyqt control part (II)
- "Niuke brush Verilog" part II Verilog advanced challenge
- 消息队列(MQ)介绍
- Leetcode simple question: the key with the longest key duration
- Human resource management system based on JSP
- Leetcode simple question: check whether the string is an array prefix
猜你喜欢
Do you know UVs in modeling?
2022 P cylinder filling test content and P cylinder filling simulation test questions
STM32 reverse entry
[PCL self study: filtering] introduction and use of various filters in PCL (continuously updated)
7. Integrated learning
Analysis of proxy usage of ES6 new feature
Integration of Android high-frequency interview questions (including reference answers)
Review the old and know the new: Notes on Data Science
"Niuke brush Verilog" part II Verilog advanced challenge
【XSS绕过-防护策略】理解防护策略,更好的绕过
随机推荐
2022 registration examination for safety production management personnel of hazardous chemical production units and examination skills for safety production management personnel of hazardous chemical
Market status and development prospect prediction of global SoC Test Platform Industry in 2022
[XSS bypass - protection strategy] understand the protection strategy and better bypass
Reptile exercise 03
[luatos sensor] 2 air pressure bmp180
关于开学的准备与专业认知
After job hopping at the end of the year, I interviewed more than 30 companies in two weeks and finally landed
Pyqt control part (II)
RSRS index timing and large and small disc rotation
MySQL winter vacation self-study 2022 12 (3)
MediaTek 2023 IC written examination approved in advance (topic)
Youdao cloud notes
Contents of welder (primary) examination and welder (primary) examination in 2022
Blog building tool recommendation (text book delivery)
[USACO 2009 Dec S]Music Notes
Concurrent operation memory interaction
General undergraduate college life pit avoidance Guide
Truncated sentences of leetcode simple questions
2022 P cylinder filling test content and P cylinder filling simulation test questions
Function introduction of member points mall system