AnsweredAssumed Answered

Return a RecordSet from a MapServer Query

Question asked by BlairServicessLLC on Apr 24, 2018
Latest reply on Apr 24, 2018 by BlairServicessLLC

Hello -

 

I'm trying to get a  MapServer query result returned as as a RecordSet.   When I try the query the a  JSON result format I get results as expected.  (Below)

 

IMapTableDescription tableDesc = GetTableDesc(Convert.ToInt32(layerID));

IQueryFilter qf = new QueryFilterClass();

qf.WhereClause = "ATTACHMENTID = " + attachmentID;

IQueryResultOptions resultOptions = new QueryResultOptionsClass();

//resultOptions.Format = esriQueryResultFormat.esriQueryResultRecordSetAsObject;

resultOptions.Format = esriQueryResultFormat.esriQueryResultJsonAsMime;

IQueryResult queryResult = this.ms.QueryData(this.ms.DefaultMapName, tableDesc, qf, resultOptions);

return queryResult.MimeData;

// Returns results in a JSON structure

 

However, when I change the  result format to a RecordSet the same query (Below) returns a NULL.

 

IMapTableDescription tableDesc = GetTableDesc(Convert.ToInt32(layerID));

IQueryFilter qf = new QueryFilterClass();

qf.WhereClause = "ATTACHMENTID = " + attachmentID;

IQueryResultOptions resultOptions = new QueryResultOptionsClass();

resultOptions.Format = esriQueryResultFormat.esriQueryResultRecordSetAsObject;

IRecordSet rs = this.ms.QueryData(this.ms.DefaultMapName, tableDesc, qf, resultOptions) as RecordSet;

// Returns a NULL

 

So, I'm missing something, but at this point am at a bit of a loss as to what.   Any suggestions would be much appreciated.

Thanks,

Ed

Outcomes