How I can remove Schema lock?That is full cod of creating shape file (C# VS2010 arcgis engine 2010): public void createShpFile(string shpName, DataTable dataTable)
{
//++++++++++++++ Create a new Shapefile with given name +++++++++++++++++++++++++++
//Get the factory
ShapefileWorkspaceFactory factory = new ShapefileWorkspaceFactory();
//Create a workspace
IWorkspaceName workspaceName = factory.Create(parentDirectory, catalogName, null, 0);
IName name = workspaceName as IName;
//QI to IFeatureWorkspace
IFeatureWorkspace featWorkspace = (IFeatureWorkspace)name.Open();
// Create a Fields collection to describe the fields of the new feature class.
IFields fields = new Fields();
IFieldsEdit fieldsEdit = fields as IFieldsEdit;
// Add an "OBJECTID" field (feature classes must have this!)
IField oidField = new Field();
IFieldEdit oidFieldEdit = oidField as IFieldEdit;
oidFieldEdit.Name_2 = "OBJECTID";
oidFieldEdit.Type_2 = esriFieldType.esriFieldTypeOID;
fieldsEdit.AddField(oidField);
// Create a geometry definition object describing the geometries
ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironmentClass();
IGeographicCoordinateSystem gcs = srFactory.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
IProjectedCoordinateSystem pcs = srFactory.CreateProjectedCoordinateSystem((int)esriSRProjCSType.esriSRProjCS_Pulkovo1942GK_6);
IGeometryDef geometryDef = new GeometryDef();
IGeometryDefEdit geomDefEdit = geometryDef as IGeometryDefEdit;
geomDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint;
geomDefEdit.SpatialReference_2 = pcs;
IField shpField = new Field();
IFieldEdit shpFieldEdit = shpField as IFieldEdit;
shpFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;
shpFieldEdit.Name_2 = "Shape";
shpFieldEdit.GeometryDef_2 = geomDefEdit;
fieldsEdit.AddField(shpField);
esriFieldType fieldType;
int fieldLength;
int i = 0;
foreach (DataColumn col in dataTable.Columns)
{
IField aField = new Field();
IFieldEdit aFieldEdit = aField as IFieldEdit;
getFieldType(col, out fieldType, out fieldLength);
aFieldEdit.Type_2 = fieldType;//esriFieldType.esriFieldTypeString
string colName = col.ColumnName;
if (colName.ToLower() == "пло�?ад�?_нелесной_зон�?")
colName = "�?ло�?ад�?Нелесной�?он�?";
else if (colName == "код_пожа�?а_сзбаол")
continue;// colName = "код�?ожа�?азбаол";
else if (colName == "код_�?айона_сзбаол")
continue;//
aFieldEdit.Name_2 = colName;
aFieldEdit.Length_2 = fieldLength;
fieldsEdit.AddField(aField);
i++;
}
//Create FeatureClass
IFeatureClass featClass = featWorkspace.CreateFeatureClass(shpName, fields, null, null, esriFeatureType.esriFTSimple, "Shape", "");
}