Failed to access to PGDB

875
3
05-23-2014 06:12 AM
ShaningYu
Frequent Contributor
Tried to access to a PGDB using the code below:
public IFeatureClass GetFCfromPGDB(string fPath, string fName) {
IWorkspaceFactory2 workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.AccessWorkspaceFactoryClass();
ESRI.ArcGIS.Geodatabase.IWorkspace pWS = workspaceFactory.OpenFromFile(fPath, 0);
IFeatureClass fc = GetFeatureClass(pWS, fName);
return fc;
}
Got COMException: Retrieving the COM class factory for component with CLSID {DD48C96A-D92A-11D1-AA81-00C04FA33A15} failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)).
How to handle this problem? Thanks.
0 Kudos
3 Replies
ShaningYu
Frequent Contributor
Referring to http://gis.stackexchange.com/questions/15940/trying-to-instantiate-geoprocessor-with-net-vs-2010, I added
            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop);
The debugging went through the the line, but got an new COMException (Exception from HRESULT: 0x80040216) at  
            ESRI.ArcGIS.Geodatabase.IWorkspace pWS = workspaceFactory.OpenFromFile(fPath, 0);
0 Kudos
DuncanHornby
MVP Notable Contributor
What are your fPath and fName variables, what do they contain?
0 Kudos
ShaningYu
Frequent Contributor
No error on fPath or fName.  I will find out why when I touch it again.  The component I used worked well before.  Thanks for your response.
What are your fPath and fName variables, what do they contain?
0 Kudos