MySQL参数化查询的IN 和 LIKE

IN子句

 

https://stackoverflow.com/questions/650455/c-sharp-parameterized-query-mysql-with-in-clause

Note: FIND_IN_SET is a mySQL specific function.

select * from orderinfobyno where FIND_IN_SET(字段,'5,8')
select * from orderinfobyno where FIND_IN_SET( 字段,'韩教练,周克')

var s = "UPDATE TABLE_1 SET STATUS = 4 WHERE FIND_IN_SET(ID, ?)";
var params = "1, 14, 145, 43";
dataSource.Execute(s, params);

FIND_IN_SET 字段类型数值和字符串都可以

like子句

select * from table where column1 like ?;

And then you set the parameter to:%searchText%

https://stackoverflow.com/questions/773641/mysql-parameterized-query-using-like

posted @ 2020-08-10 18:15  zzljh  阅读(1575)  评论(0编辑  收藏  举报