Select to view content in your preferred language

Deleting a FeatureClass...or an Alternative Solution to my Situation

1098
3
04-29-2010 05:54 AM
NickClayton
Emerging Contributor
Hi all, first let me describe my situation as there may be a better way of handling it.

I am working with ArcEngine 9.3.1 with C#. I have a search form that allows the user to query for data in any field and
display the results. I have a second form that can be displayed at that point to display a colored layer over the results.

I want to be able to color in the results with different colors based on sub queries.
I thought of using a uniquevaluerenderer for this as it would give me the layer layout that I need (color coded categories), but unfortunately with it needing unique values, I can't use wildcards to grab multiple polygons.

I decided then that I would create my own featureclass on-the-fly and populate it with my results and adding a field
to indicate what records belonged to what color group, that way I could use the uniquevaluerenderer.

An Example:
I query for all parcel numbers that start 074
With those results, I would like to color code them in the following way:
074A = Red
074B = Yellow
074C = Green
etc

I dug around and finally figured out how to add a featureclass and can populate it the way I want, but now the problem is...I can't delete it. I really don't want to leave my featureclass in the geodatabase after the query results have been displayed.

When I try to delete the featureclass (using DeleteByName() from IFeatureWorkspaceManage), I get the error message
"The application is not licensed to perform this operation". Why would I be licensed to create but not to delete?

Any help on this would be much appreciated
0 Kudos
3 Replies
AndrewChapkowski
Esri Regular Contributor
Try setting the license level to ArcEditor or Above.  See the following:
http://resources.esri.com/help/9.3/ArcGISDesktop/dotnet/2efb9e94-81b7-4088-af80-602ca92a2bb1.htm
0 Kudos
EricPaitz
Esri Contributor
Its a bit of a long shot but make sure you have released any ArcObjects (COM) to the Feature Class you are trying to delete. So use the ESRI.ArcGIS.ADF.ComReleaser on any classes like FetureClass, FeatureLayer, or FeatureCursor. If there is still a reference to the FeatureClass I do not think it can be deleted.

Also, another alternative might be to use an InMemoryWorkSpaceFactory. This should be created when your application starts and it gets destroyed when your application shuts down. Just an idea to try.
0 Kudos
NickClayton
Emerging Contributor
The InMemoryWorkSpaceFactory was exactly what I needed. Thank you for the responses, it has helped me move forward and I have some new tricks at my disposal 😄
0 Kudos