Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sqlite 如何使用LINQ查询获取以大写、小写或组合形式保存的特定记录的计数_Sqlite_Xamarin.forms - Fatal编程技术网

Sqlite 如何使用LINQ查询获取以大写、小写或组合形式保存的特定记录的计数

Sqlite 如何使用LINQ查询获取以大写、小写或组合形式保存的特定记录的计数,sqlite,xamarin.forms,Sqlite,Xamarin.forms,我需要从SoccerStatus中获取IN/IN/IN的计数,无论记录是以大写、小写形式保存,还是以Xamarin表单的SQLite数据库中ieIN或IN或IN的组合保存。我怎样才能做到这一点 var count_in=(从conn.Table()中的x开始。其中(x=>x.SoccerStatus==in)选择x)。count(); 使用string.Equals并告诉它忽略大小写 var count_in = (from x in conn.Table<SoccerAvailabil

我需要从
SoccerStatus
中获取
IN/IN/IN
的计数,无论记录是以大写、小写形式保存,还是以Xamarin表单的SQLite数据库中ie
IN或IN或IN的组合保存。我怎样才能做到这一点

var count_in=(从conn.Table()中的x开始。其中(x=>x.SoccerStatus==in)选择x)。count();

使用string.Equals并告诉它忽略大小写

var count_in = (from x in conn.Table<SoccerAvailability>().Where(x => string.Equals(x.SoccerStatus, "IN", StringComparison.OrdinalIgnoreCase)) select x).Count();
var count_in=(从conn.Table()中的x开始,其中(x=>string.Equals(x.SoccerStatus,“in”,StringComparison.OrdinalIgnoreCase))选择x.count();
编辑:根据您的评论,我发现您使用的Linq提供程序不支持string.Equals。您可以尝试以下方法,它应该更便携,但可能会慢一点

var count_in = (from x in conn.Table<SoccerAvailability>().Where(x => x.SoccerStatus.ToUpper() == "IN") select x).Count();
var count_in=(从conn.Table()中的x开始,其中(x=>x.SoccerStatus.ToUpper()==“in”)选择x.count();

将尝试此操作并回复shortly@dazedandconfused-现在我得到了数据库异常SQLite exception
没有这样的函数等于
,你能帮我一下吗
var count_in = (from x in conn.Table<SoccerAvailability>().Where(x => x.SoccerStatus.ToUpper() == "IN") select x).Count();