Question on IRow...

710
6
01-14-2011 09:39 AM
JoshV
by
Occasional Contributor
This isn't making much sense to me so I'm hoping somebody here can help.  I have a C# standalone console app that uses ArcObjects to add data into a newly created Feature Class.  Below is part of my code and it worked great on a Windows XP 64-bit machine that was running ArcGIS 9.3.1.  Now I have moved my application over to a Windows 2008 Server running ArcGIS 10 SP1 and I'm getting an error at pNewRow.set_Value((int)l_FCWellID, pRow.get_Value((int)l_WellID));  It just states that "object does not contain a definition for "set_Value"" 

I don't get it because when I check the methods, pNewRow clearly has .set_Value as an option.  And Yes each parameter in set_Value in the loop below does have an actual value at runtime.  Does anyone have some advice for me?  Thank you in advance..

IRow pNewRow;
                    
                    do
                    {
                        pNewRow = pNewTable.CreateRow();
                        
                        pNewRow.set_Value((int)l_FCWellID, pRow.get_Value((int)l_WellID)); 
                        pNewRow.set_Value((int)l_FCWellAlias, pRow.get_Value((int)l_WellAlias));
                        pNewRow.set_Value((int)l_FCWellName, pRow.get_Value((int)l_WellName));
                        pNewRow.set_Value((int)l_FCAPI, pRow.get_Value((int)l_API));
                        pNewRow.set_Value((int)l_FCOPERATOR, pRow.get_Value((int)l_OPERATOR));
                        pNewRow.set_Value((int)l_FCTEAM, pRow.get_Value((int)l_TEAM));
                        pNewRow.Store();

                        pRow = pTableCursor.NextRow();
                        
                    } while (pRow != null);
0 Kudos
6 Replies
JoshV
by
Occasional Contributor
Does anyone have any good suggestions?  If I haven't provided enough information or you have any suggestions then please let me know.  Many Thanks
0 Kudos
RichardWatson
Frequent Contributor
Standalone programs in version 10 have to do some additional work before calling ArcObjects:

http://blogs.esri.com/Dev/blogs/arcgisdesktop/archive/2010/07/19/Bind-and-License-your-standalone-Ar...

I haven't a clue whether or not this relates to your problem.  Just trying to help by throwing out ideas.

Update.  Here is a better link which describes the set of additional things that you need to do in version 10:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/What_s_new_for_develope...
0 Kudos
JoshV
by
Occasional Contributor
Standalone programs in version 10 have to do some additional work before calling ArcObjects:

http://blogs.esri.com/Dev/blogs/arcgisdesktop/archive/2010/07/19/Bind-and-License-your-standalone-Ar...

I haven't a clue whether or not this relates to your problem.  Just trying to help by throwing out ideas.

Update.  Here is a better link which describes the set of additional things that you need to do in version 10:

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/What_s_new_for_develope...


Hi Richard-  Thank you for the response.  I don't think that is the problem I am experiencing as I already initialize the license in my Main with the below code before I ever utilize any ArcObjects.  Thoughts?

 if (!ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop))
            {
                MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down.");
                return;

            }
            else
            {
                IAoInitialize ao = new AoInitialize();
                ao.Initialize(esriLicenseProductCode.esriLicenseProductCodeArcInfo);
                            }
0 Kudos
RichardWatson
Frequent Contributor
Is the feature that you are creating a custom feature class?  If so then did you register it using ESRIRegAsm? 

I am just trying to think of things that changed between 9.3.1 and 10.
0 Kudos
JoshV
by
Occasional Contributor
Is the feature that you are creating a custom feature class?  If so then did you register it using ESRIRegAsm? 

I am just trying to think of things that changed between 9.3.1 and 10.


Hi Richard-

I'm creating a Table inside of a Personal Geodatabase.  I create the columns using the code below and the columns do get created but I notice I use ESRI.ArcGIS.Geodatabase.Field();  instead of ESRI.ArcGIS.Geodatabase.FieldClass();  That puzzles me.  Whenever I try to use FieldClass() I get a "FieldClass cannot be embedded, use applicable interface instead."  So instead of using FieldClass I use Field and the fields still get created but whenever I loop through the newly created table I'm not able to add data to a particular row as I first stated.  The error thrown is "object does not contain definition for 'set_value'  Thoughts?

ESRI.ArcGIS.Geodatabase.IObjectClassDescription objectClassDescription = new ESRI.ArcGIS.Geodatabase.ObjectClassDescription();




                    ESRI.ArcGIS.Geodatabase.IField pField;
                    IFieldEdit pFieldEdit;
                    IFields pFields = objectClassDescription.RequiredFields;//new Fields();
                    IFieldsEdit pFieldsEdit = (ESRI.ArcGIS.Geodatabase.IFieldsEdit)pFields;
                    pField = new ESRI.ArcGIS.Geodatabase.Field();
                    pFieldsEdit.FieldCount_2 = 62;

                    pField = new Field();
                    pFieldEdit = (ESRI.ArcGIS.Geodatabase.IFieldEdit)pField;
                    pFieldEdit.Name_2 = "Well_ID";
                    pFieldEdit.Type_2 = esriFieldType.esriFieldTypeString;
                    pFieldEdit.Length_2 = 15;
                    pFieldsEdit.set_Field(0, pField);  

                    .....
0 Kudos
JoshV
by
Occasional Contributor
I ended up using an arcpy script to get this to finally work.  So in short I never figured out why I couldn't use the IRow method above.
0 Kudos