Hi,I am trying to update my feature class via IWorkspace.edit session by using ICursor.update methord .Following is what i am trying to do
while ((row = cursor.nextRow()) != null){
IWorkspace iworkspace = workspace;
IWorkspaceEdit iworkedit = (IWorkspaceEdit) iworkspace;
iworkedit.startEditing(true);
iworkedit.startEditOperation();
int typeFieldIndex = className2.findField(fieldName);
IQueryFilter queryFilter = new QueryFilter();
queryFilter.setWhereClause(fieldName+" = "+ row.getValue(fieldName2));
// Create a Search cursor.
IFeatureCursor searchCursor = (IFeatureCursor) className2.update(queryFilter, false);
// Edit the features matching the query.
IFeature feature = null;
try
{
while ((feature = searchCursor.nextFeature()) != null)
{
feature.setValue(typeFieldIndex, null);
searchCursor.updateFeature(feature);
}
}
catch (Exception comExc)
{
comExc.printStackTrace();
// Handle any errors that might occur on NextFeature().
}
iworkedit.stopEditOperation();
iworkedit.stopEditing(true);
}
While running the code i get following error Error: AutomationException: The Microsoft Jet database engine cannot find the input table or query 'GDB_ReplicaChanges'. Make sure it exists and that its name is spelled correctly.And point out to following line --IFeatureCursor searchCursor = (IFeatureCursor) className2.update(queryFilter, false);What is the issue here , according to me the classname2 feature class exists and name is spelled dynamically so no issue of "spelled correctly", other than that what is wrong here.For same problem i tried a different approach -I initialised edit session as follows at beginning of program -- IWorkspaceFactory workspaceFactory = new AccessWorkspaceFactory();
IWorkspace iworkspace = new Workspace(workspaceFactory.openFromFile(locatePgdb, 0));
IWorkspaceEdit iworkedit = (IWorkspaceEdit) iworkspace;
iworkedit.startEditing(true);
iworkedit.startEditOperation();
And then i passed my query like this --int typeFieldIndex = className2.findField(fieldName);
IQueryFilter queryFilter = new QueryFilter();
queryFilter.setWhereClause(fieldName+" = "+ row.getValue(fieldName2));
// Create a Search cursor.
IFeatureCursor searchCursor = (IFeatureCursor) className2.update(queryFilter, true);
// Edit the features matching the query.
IFeature feature = null;
try
{
while ((feature = searchCursor.nextFeature()) != null)
{
feature.setValue(typeFieldIndex, null);
searchCursor.updateFeature(feature);
feature.store();
}
}
catch (Exception comExc)
{ comExc.printStackTrace();
// Handle any errors that might occur on NextFeature().
}
Then i am having error of --Objects in this class cannot be updated outside an edit session [Service]Kindly provide me wats wrong being done here ////