I got the same HRESULT error (0x8004152f) when using the following code:
It starts with this statement:
string strQuery = "PL_PMAP == '" + txtTile.Text + "'";
which is then passed in as one of the parameters in the following statement:
clsQuery.QueryPoly("Match Sheet", strQuery, txtTile.Text, featureSelection, 2);
and here is the recipient class:
class clsQuery
{
private static IQueryFilter queryFilter = new QueryFilterClass();
public static void QueryPoly(string dataFrame, string query, string tileNum, IFeatureSelection featureSelection, Int32 index)
{
queryFilter.WhereClause = query;
featureSelection.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, true);
The query is "PL_PMAP = '555'". Everything about these statements look right -- the correct feature class is selected; it contains a string field called PL_PMAP; and, '555' is an actual value in that field.
I don't understand your statement about looking in the interface (IFeatureSelection?) to discover the cause of this error. The limited amount of additional information about the error is also vague, although I suspect a permissions issue (???)
Thanks in advance for any light you can throw on this.