Gets or sets an SQL statement which represents the "WhereClause" used to query the Table.

Namespace:  ESRI.ArcGISExplorer.Data

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public string WhereClause { get; set; }
Visual Basic (Declaration)
Public Property WhereClause As String

Field Value

An SQL statement.

Remarks

The SQL syntax used in the WhereClause must be supported by the underlying database and additionally must be supported by the ArcGIS Explorer API. For more information and links to other documents which discuss SQL syntax, see How to Search a Table.

Examples

The code below demonstrates the use of the WhereClause property by providing some examples of commonly used SQL clauses.
CopyC#
  //Open the countries Table
Table countriesTable = Table.OpenFileGeodatabaseTable(@"C:\Data\World.gdb", "countries");

  //Create a new Filter 
  Filter searchCriteria = new Filter();

  //Example 1 - String "Equals"
  searchCriteria.WhereClause = "NAME = 'Japan'";
  //Execute query - the RowCollection contains 1 row for Japan
  RowCollection searchedRows = countriesTable.Search(searchCriteria);

  //Example 2 - String "LIKE" with wildcard
  searchCriteria.WhereClause = "NAME LIKE 'J%'";
  //Execute query - the RowCollection contains 3 rows: Japan, Jamaica, Jordan
  searchedRows = countriesTable.Search(searchCriteria);

  //Example 3 - Combining Expressions
  searchCriteria.WhereClause = "NAME LIKE 'J%' AND CONTINENT = 'Asia'";
  //Execute query - the RowCollection contains 2 rows: Japan, Jordan
  searchedRows = countriesTable.Search(searchCriteria);

  //Example 4 - Using subqueries (note - not supported for shapefiles)
  searchCriteria.WhereClause = "FIPS_CODE IN (SELECT FIPS_CODE FROM DEMOGRAPHICS WHERE POPDENSITY > 1000)";
  //Execute query
  searchedRows = countriesTable.Search(searchCriteria);
CopyVB.NET
'Open the countries Table
Dim countriesTable As Table = Table.OpenFileGeodatabaseTable("C:\Data\World.gdb", "countries")

'Create a new Filter 
Dim searchCriteria As Filter = New Filter()

'Example 1 - String "Equals"
searchCriteria.WhereClause = "NAME = 'Japan'"
'Execute query - the RowCollection contains 1 row for Japan
Dim searchedRows As RowCollection = countriesTable.Search(searchCriteria)

'Example 2 - String "LIKE" with wildcard
searchCriteria.WhereClause = "NAME LIKE 'J%'"
'Execute query - the RowCollection contains 3 rows: Japan, Jamaica, Jordan
searchedRows = countriesTable.Search(searchCriteria)

'Example 3 - Combining Expressions
searchCriteria.WhereClause = "NAME LIKE 'J%' AND CONTINENT = 'Asia'"
'Execute query - the RowCollection contains 2 rows: Japan, Jordan
searchedRows = countriesTable.Search(searchCriteria)

'Example 4 - Using subqueries (note - not supported for shapefiles)
searchCriteria.WhereClause = "FIPS_CODE IN (SELECT FIPS_CODE FROM DEMOGRAPHICS WHERE POPDENSITY > 1000)"
'Execute query
searchedRows = countriesTable.Search(searchCriteria)

See Also