使用SqlFunc.EndsWith迷糊查询查不出来数据 求解 返回
使用SqlFunc.EndsWith迷糊查询查不出来数据 求解
public static Object Find_Stock(string shopId)
{
SqlSugarClient db = new SqlSugarClient(
new ConnectionConfig()
{
ConnectionString= "server=127.0.0.1;uid=sa;pwd=12315;database=Test;",
DbType=DbType.SqlServer,
InitKeyType=InitKeyType.Attribute,
IsAutoCloseConnection=true
}
);
db.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql + "\r\n" +
db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
Console.WriteLine();
};
var stock = db.Queryable<Try_Stock>().Where(u=>SqlFunc.EndsWith(u.item_no, shopId)).ToList();
return stock;
}
控制台打印出的语句【
SELECT * FROM (SELECT [Id],[item_no],[branch_no],[stock_qty],[avg_cost],[cost_amt],[last_inprice],[oper_date],ROW_NUMBER() OVER(ORDER BY GETDATE() ) AS RowIndex FROM [t_im_branch_stock] WHERE ([item_no] like '%'+@MethodConst0) ) T WHERE RowIndex BETWEEN 1 AND 1
{"@MethodConst0":'6909409012017'}
】
热忱回答(1)
-
fate stay night VIP0
2020/7/28以SQL为准看S QL为什么查不出来
0 回复