问题

问题:在 ArcGIS Pro SDK 中运行具有无效 SQL 语句的 SQL 查询时会返回查询错误

Last Published: April 24, 2024

描述

In ArcGIS Pro SDK, when attempting to perform a SQL query with an invalid SQL statement, the following error is returned:

Query Error: An invalid SQL statement was used.

原因

The 1.4 version of Esri's Github Community samples for ArcGIS Pro SDK use the new C# 6 features that are available with Visual Studio 2015. For example, the interpolated string ($), such as in the following sample: Filter features based on attributes within an extent.
Line 143 of the Dockpane1ViewModel.cs has the following ling of code:

var whereClause = $"{SelectedField} = {quote}{FieldValue}{quote}";
Notice the use of the string interpolation operator (the dollar sign, $). This operator is only supported in Visual Studio 2015 and later. Attempting to use it in Visual Studio 2013 results in a compile error. Deleting it removes the compile error, but on running the code, a runtime error is returned.
Query Error: An invalid SQL statement was used

解决方案或解决方法

The solution to this problem is to either hard-code the values for the string manually using supported features of Visual Studio 2013, or to upgrade Visual Studio to version 2015 to take advantage of the new C# 6 features, such as the interpolated string ($). For more information on the interpolated string, see the following post, Stack Overflow: What's with the dollar sign ($"string").

文章 ID:000015910

从 ArcGIS 专家处获得帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项

相关信息

发现关于本主题的更多内容