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?