gpt4 book ai didi

c# - 如何在 SqLite Linq 查询中使用方法?

转载 作者:行者123 更新时间:2023-11-30 17:03:20 24 4
gpt4 key购买 nike

我想在 linq 查询中使用 Tolower 字符串函数,但是当应用程序运行时,lnq 在 sqlite 中搜索该函数。

错误:

Additional information: no such function: tolower

代码:

 var data = conn.Table<_table>().Where(x=> x.name.ToLower() == param).ToList();

如何在 linq 查询中使用非 sqlite 函数?

感谢任何帮助!

最佳答案

一个选项是使您正在比较的列不区分大小写。然后您将不再需要使用 ToLower 来比较您的字符串,因为它最终会将您的 linq 转换为 sql 语句。

CREATE TABLE MyTable 
(
name text collate nocase
);

关于c# - 如何在 SqLite Linq 查询中使用方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18674222/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com