I am using ArcObjects 10.2, I'm trying to join two tables that I have in a filegeodatabase.
This is my code:
// Arrange var path = @"c:\MY_FGDB.gdb"; var gdbConnector = new GeoDBConnector(); IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactoryClass(); var ws = workspaceFactory.OpenFromFile(path, 0); // Act var tableOfRoutes = gdbConnector.OpenTable(ws as IWorkspace2, "Table1"); var tableWithFeatures = gdbConnector.OpenTable(ws as IWorkspace2, "Table2"); // Create the query definition. IQueryDef queryDef = (ws as IFeatureWorkspace).CreateQueryDef(); queryDef.Tables = "Table1, Table2"; queryDef.SubFields = "*"; queryDef.WhereClause = "Table1.EventID = Table2.Inspection"; // Make the new TableQueryName. IQueryName2 queryName2 = (IQueryName2)new TableQueryNameClass(); queryName2.QueryDef = queryDef; queryName2.PrimaryKey = "Table1.EventID"; queryName2.CopyLocally = true; // Set the workspace and name of the new QueryTable. IDatasetName datasetName = (IDatasetName)queryName2; datasetName.WorkspaceName = ws as IWorkspaceName; datasetName.Name = "inspectionData"; // Open and return the table. IName name = (IName)queryName2; ITable InspectionTable = (ITable)name.Open();
At line 31, I get the following exception:
The data necessary to complete this operation is not yet available. (Exception from HRESULT: 0x8000000A)
What I am missing?
Solved! Go to Solution.
OK, I just figured that in the line 26, I was setting the workspace name in the wrong way, the correct way is:
datasetName.WorkspaceName = (ws as IDataset).FullName as IWorkspaceName;
but now, there is the following exception:
"Value does not fall within the expected range."........but Which value? what does it mean?
OK, I just figured that in the line 26, I was setting the workspace name in the wrong way, the correct way is:
datasetName.WorkspaceName = (ws as IDataset).FullName as IWorkspaceName;
but now, there is the following exception:
"Value does not fall within the expected range."........but Which value? what does it mean?
My mistake, I was setting wrong the primary key