疑似 IDataStatistics 接口导致的 System.AccessViolationException异常
在程序中使用了 IDataStatistics 这个借口结果再次打开mdb数据的时候出现System.AccessViolationException异常。改为自己在循环中统计,则没有再出现异常。
哪位遇到过,或者是我的IDataStatistics接口使用方法不正确。哪位知道的请不吝赐教,谢谢!
==以下是调用接口的代码片段===
IFeatureCursor cursor = fc.Search(null, true);
ESRI.ArcGIS.Geodatabase.IDataStatistics dataStatistics = new DataStatistics();
dataStatistics.Cursor = cursor as ICursor;
dataStatistics.Field = codeFieldInDB;
System.Collections.IEnumerator enumerator = dataStatistics.UniqueValues;
enumerator.Reset();
IList<string> codeList = new List<string>();
while (enumerator.MoveNext())
{
codeList.Add(enumerator.Current.ToString());
}
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(cursor);
哪位遇到过,或者是我的IDataStatistics接口使用方法不正确。哪位知道的请不吝赐教,谢谢!
==以下是调用接口的代码片段===
IFeatureCursor cursor = fc.Search(null, true);
ESRI.ArcGIS.Geodatabase.IDataStatistics dataStatistics = new DataStatistics();
dataStatistics.Cursor = cursor as ICursor;
dataStatistics.Field = codeFieldInDB;
System.Collections.IEnumerator enumerator = dataStatistics.UniqueValues;
enumerator.Reset();
IList<string> codeList = new List<string>();
while (enumerator.MoveNext())
{
codeList.Add(enumerator.Current.ToString());
}
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(cursor);
2 个回复
nfc - GISer
赞同来自:
朱新颖
赞同来自:
要回复问题请先登录或注册
发起人
GISer
相关问题
问题状态