Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I need to calculate total count of distinct values of a field . That field contains many duplicate values also. The table which contains that field is stored in pgdb. I want things done in vb .net. Any help is appreciated.

share|improve this question
add comment

1 Answer 1

If you are using ArcObjects, you would do this by IDataStatistics and IStatisticsResults

A 9.3 Example is here.

If you are using a personal geodatabase (which uses MS Access), you could use ADO and do a SELECT DISTINCT <fieldname> FROM <TableName> You can search SO for this info: http://stackoverflow.com/search?q=%5Bms-access%5D+votes%3A5+ADO+SELECT+DISTINCT

share|improve this answer
    
Unable to cast object of type 'System.Runtime.InteropServices.CustomMarshalers.EnumeratorViewOfEnumVariant' to type 'ESRI.ArcGIS.esriSystem.IEnumVariantSimple'. Above error is showing when i use the code from 9.3 example.enumVar = CType(dataStats.UniqueValues, IEnumVariantSimple) .However i did it using Hashset.Thanks Jay for help. –  Navish Aug 30 '12 at 9:58
    
Dim datastats As IDataStatistics datastats = New ESRI.ArcGIS.Geodatabase.DataStatisticsClass datastats.Field = "IPID" datastats.Cursor = pCursor Dim enumerator As IEnumerator enumerator = datastats.UniqueValues enumerator.Reset() Do While (enumerator.MoveNext()) Dim myobject As Object myobject = enumerator.Current i = i + 1 Loop –  Navish Aug 31 '12 at 4:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.