gpt4 book ai didi

vb.net - 未定义的函数调用 lower()

转载 作者:行者123 更新时间:2023-12-01 22:29:48 30 4
gpt4 key购买 nike

我在 sqlite 查询中遇到以下异常:

The expression contains undefined function call lower()

我在 VS2012 中有一个非常简单的 SQLite 类型数据集。

我正在解析大量数据,并希望在添加新行之前检查行是否已存在。

我使用 .select() 方法返回数据行数组。如果数组的长度为零,我添加一个新的。简单!

一切都运行良好,但我添加了一项检查,以防止在大小写错误的情况下添加重复行。我正在存储文件名。

选择语句是:

"lower(FileName) = '" + EscapeFileName(strFileName).ToLower() + "'"

但是我在 lower(FileName) 上收到上述错误。如果我删除它,效果很好,但显然检查不具有可比性。

该语句在 SQLiteAdmin 中按预期工作。

最佳答案

如果我理解正确的话,您有一个 .NET DataTable (查询的结果)并且您正在调用 DataTable.Select(string)传入一个 where 子句。

这个 where 子句由 .NET 处理,而不是由 SQLite 处理(正如 Tim 所指出的)。您不能在 DataTable 的 Select 函数中使用 SQLite(或任何其他 DBMS)函数。您可以使用这些功能:

  • CONVERT – converts particular expression to a specified .NET Framework type
  • LEN – gets the length of a string
  • ISNULL – checks an expression and either returns the checked expression or a replacement value
  • IIF – gets one of two values depending on the result of a logical expression
  • TRIM – removes all leading and trailing blank characters like \r, \n, \t, ‚ ‘
  • SUBSTRING – gets a sub-string of a specified length, starting at a specified point in the string

参见DataView RowFilter Syntax [C#]了解更多信息。

关于vb.net - 未定义的函数调用 lower(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15138166/

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