POST
|
Attempted to read or write protected memory. This is often an indication that other memory is corrupt. when trying to add an index to a feature class the error happens at the last line befor the return statment. please help protected bool CreateIndex( IFeatureClass featClass, params object[] fieldsNames) { IFields pFields = new Fields(); IField pField; IFieldsEdit pFieldsEdit; pFieldsEdit = (IFieldsEdit)pFields; pFieldsEdit.FieldCount_2 = fieldsNames.Length + 1; int h; string indexName=""; for (int i = 0; i < fieldsNames.Length; i++) { h = featClass.FindField(fieldsNames.ToString()); // pField = featClass.Fields.get_Field(h); pFieldsEdit.set_Field(i, featClass.Fields.get_Field(h)); pField = null; indexName = indexName + ((i == 0) ? fieldsNames.ToString() : "," + fieldsNames.ToString()); } IIndex pIndex= new Index(); IIndexEdit pIndexEdit =(IIndexEdit) pIndex; pIndexEdit.Fields_2 = pFields; pIndexEdit.Name_2 = indexName; featClass.AddIndex(pIndex); //this the line where the error takes place return true; }
... View more
06-12-2013
07:45 AM
|
0
|
0
|
387
|
POST
|
Hi I'm trying to create a FetureDataset. this is my code: ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference fdsSR; fdsSR = spatialReferenceFactory.CreateESRISpatialReferenceFromPRJFile( "C:\\Users\\user\\AppData\\Local\\VirtualStore\\Program Files\\ArcGIS\\Coordinate Systems\\Projected Coordinate Systems\\National Grids\\ITM_stt.prj"); IWorkspace wksp; string path = "C:\\DC\\Programming\\GIS\\Samples\\MapTable"; wksp = CreateFileGDB(path, "DataX1"); IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)wksp; featureWorkspace.CreateFeatureDataset("DataX", fdsSR); when i run it I get this error on the last line: System.Runtime.InteropServices.COMException was unhandled HelpLink="esri_csGeoDatabase.hlp" Message="The table was not found. [GDB_DBTune]" Source="ESRI GeoDatabase" ErrorCode=-2147216882 StackTrace: at ESRI.ArcGIS.Geodatabase.IFeatureWorkspace.CreateFeatureDataset(String Name, ISpatialReference SpatialReference) at Map_A_Table.Form1.button1_Click(Object sender, EventArgs e) in C:\DC\Programming\GIS\Samples\MapTable\Map_A_Table\Map_A_Table\Form1.cs:line 409 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at Map_A_Table.Program.Main() in C:\DC\Programming\GIS\Samples\MapTable\Map_A_Table\Map_A_Table\Program.cs:line 23 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: Help!!
... View more
02-02-2012
12:46 AM
|
0
|
1
|
953
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|