更新时间:2022-04-18 22:37:01
首先,为什么不使用格式而不是combersome switch
?接下来,不要
在查询中使用 *
,只需枚举您真正想要的所有列:
First, why not use formatting instead of combersome switch
? Next, do not
use *
in the query, just enumerate all the columns you really want:
cmd.CommandText = String.Format(
@"select Id,
Quantity,
Unit --TODO: Add other required columns here
from Inventory
where {0} like @searchKey", value);