private void menuItemSetColumns_Click(object sender, System.EventArgs e) { try { // build up a search info by hand (not using the factory) QueryFilter filter = new SqlExpressionFilter("POP_90 < 1000000"); QueryDefinition qd = new QueryDefinition(filter, "MI_Key"); // to Add Columns qd.AppendColumns("State", "MI_Geometry"); // to set all new set of columns // not using MI_Geometry here string[] cols = new string[] { "MI_Key", "MI_Style", "State_Name", "POP_90", "Households_90" }; qd.Columns = cols; // Note: if you are doing a multi table search, the columns must apply to each table // alternatively, you can derive a new class from QueryDefinition and // override the GetColumns() method to return different columns for each table being searched SearchInfo si = new SearchInfo(null, qd); IResultSetFeatureCollection fc = _catalog.Search("mexico", si); // set map view to show search results _map.SetView(_map.Layers["mexico"] as FeatureLayer); // show results as selection SelectFeatureCollection(fc); } finally { Cursor.Current = Cursors.Default; } }
private void menuItemSetColumns_Click(object sender, System.EventArgs e) { try { // build up a search info by hand (not using the factory) QueryFilter filter = new SqlExpressionFilter("POP_90 < 1000000"); QueryDefinition qd = new QueryDefinition(filter, "MI_Key"); // to Add Columns qd.AppendColumns("State", "MI_Geometry"); // to set all new set of columns // not using MI_Geometry here string[] cols = new string[] {"MI_Key", "MI_Style", "State_Name", "POP_90", "Households_90"}; qd.Columns = cols; // Note: if you are doing a multi table search, the columns must apply to each table // alternatively, you can derive a new class from QueryDefinition and // override the GetColumns() method to return different columns for each table being searched SearchInfo si = new SearchInfo(null, qd); IResultSetFeatureCollection fc = _catalog.Search("mexico", si); // set map view to show search results _map.SetView(_map.Layers["mexico"] as FeatureLayer); // show results as selection SelectFeatureCollection(fc); } finally { Cursor.Current = Cursors.Default; } }