Last active
August 29, 2015 14:16
-
-
Save alamsal/4a3987cbb857f0635e91 to your computer and use it in GitHub Desktop.
Query personal gdb using ORDER BY and DISTINCT clause
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ICursor QueryRowViaQueryDef(IFeatureWorkspace featureWorkspace, String tables, String subFields, String whereClause) | |
{ | |
// Create the query definition. | |
IQueryDef2 queryDef = featureWorkspace.CreateQueryDef() as IQueryDef2; | |
// Provide a list of table(s) to join. | |
queryDef.Tables = tables; | |
// Declare the subfields to retrieve. | |
queryDef.SubFields = subFields; | |
// Assign a where clause to filter the results. | |
queryDef.WhereClause = whereClause; | |
queryDef.PrefixClause = "DISTINCT"; | |
queryDef.PostfixClause = "ORDER BY "+subFields+" ASC"; | |
// Evaluate queryDef to execute a database query and return a cursor to the application. | |
ICursor cursor = queryDef.Evaluate(); | |
return cursor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment