I'm unable to get a workspace from an sde connection and assign the pFeatureWorkspace to it. Here's the VB code:
Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory")
Dim pWorkspaceFactory As IWorkspaceFactory2
Dim pFeatureWorkspaceA As IFeatureWorkspace
Dim pFeatureWorkspaceB As IFeatureWorkspace
Dim featureWorkspace As ESRI.ArcGIS.Geodatabase.IFeatureWorkspace
‘thePropSet, theWorkspace, fimWorkspace, fimPropSet are global variables
Try
pWorkspaceFactory = CType(Activator.CreateInstance(factoryType), IWorkspaceFactory)
'ReadConnectionPropertiesFromFile
theWorkspace = pWorkspaceFactory.OpenFromFile(theFilesLoc & "dnrgdrs-prod1-pg-dc-pfmm_dev.sde", 0)
thePropSet = theWorkspace.ConnectionProperties
fimWorkspace = pWorkspaceFactory.OpenFromFile(theFilesLoc & "\FOR01-ORA-DC-LRSDB-FIM-DEFAULT.sde", 0)
fimPropSet = fimWorkspace.ConnectionProperties
‘Both of these give empty results
pFeatureWorkspaceA = CType(theWorkspace, IFeatureWorkspace)
pFeatureWorkspaceB = CType(fimWorkspace, IFeatureWorkspace)
The pFeatureWorkspace is always empty. The database has data, but somehow it can't find it.
When debugging, I get "No children available"
Thank you for any advice.
Solved! Go to Solution.
I found out that just because it gives an error: no children available, doesn't mean that the workspace isn't valid. Once the workspace is defined, a request to get a table is made and I was getting an error when trying to open a table. So I thought it was because of the no children error, but it wasn't. When opening the table, I was including the name of the schema with the name of the table: schema.Table_Name and that's what was the real problem. I just needed to use the name of the table.
Have you confirmed that theWorkspace is not Nothing?
I found out that just because it gives an error: no children available, doesn't mean that the workspace isn't valid. Once the workspace is defined, a request to get a table is made and I was getting an error when trying to open a table. So I thought it was because of the no children error, but it wasn't. When opening the table, I was including the name of the schema with the name of the table: schema.Table_Name and that's what was the real problem. I just needed to use the name of the table.
Hi,
what version on ArcGIS are you using? and is it a standalone application? Starting from 10.0 version in standalone application Runtime license binding is a requirement.
Shriram,
Thank you for asking. I'm using 10.2 and it is an addin. However, the no children error wasn't actually the problem. The opentable method on the feature workspace wouldn't return anything, so I thought it was because of that error. However, it was actually because I was adding the schema name with the table. This was an extension developed for 9.3 and at that time, you needed to have the schema name with the table name. With 10.2, you don't.
But thank you so much for participating.