[fdo-users] RE: .net Wrapper quirks

Bohne thomas_bonsiepen at web.de
Sat Jul 24 07:43:11 EDT 2010


Thank you too, Clayton Hotson. 
Now I'm adding the Property value outside the loop, and only allocate the
value. I think that is what you meant? 
Still no luck :-(


   private void writeValues(FDO.IFDOSource source, FDO.IFDOSource target,
Graphics graphics)
        {
            //Open Source Connection, if necessary 
            if (source.Connection.ConnectionState !=
OSGeo.FDO.Connections.ConnectionState.ConnectionState_Open)
                source.Connection.Open();
            //Open Target Connection, if necessary 
            if (target.Connection.ConnectionState !=
OSGeo.FDO.Connections.ConnectionState.ConnectionState_Open)
                target.Connection.Open();

            //Creating Select Command
            ISelect select =
source.Connection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Select)
as ISelect;
            //setting featureClassName
            select.SetFeatureClassName(source.getFeatureClassName());

           //Filter source
            if (graphics.Filter.Length > 0)
                select.Filter =
OSGeo.FDO.Filter.Filter.Parse(graphics.Filter);

            //creating InsertCommand
            IInsert insert =
target.Connection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Insert)
as IInsert;
            
            //setting featureClassName
            insert.SetFeatureClassName(target.getFeatureClassName());
            
            PropertyValue moveIDValue = new PropertyValue();
            moveIDValue.Name = new Identifier("MOVEID");

            insert.PropertyValues.Add(moveIDValue);
              
 //Counter 
            int counter = 0;

            //create Reader
            using (IFeatureReader sourceReader = select.Execute())
            {


                while (sourceReader.ReadNext())
                {
                    //Clear old insertcommand
                    //insert.PropertyValues.Clear();
                    //Adding PropertyValues to InsertCommand
                    bool writeRecord = true;// fillRow(ref insert, source,
sourceReader, target.MyFeatureClass, graphics, counter);
                    //insert.PropertyValues.Add(new PropertyValue("MOVEID",
new Int32Value(counter)));
                    insert.PropertyValues[0].Value = new
Int32Value(counter);
                    //
                    if (writeRecord)
                    {
                        //Executing InsertCommand  
                        using (IFeatureReader insertReader =
insert.Execute())
                        {
                            insertReader.Close();
                        }
                        //insert.Execute();

                    }

                    counter++;
                }

            }
            insert.Dispose();
            select.Dispose();
            //source.Connection.Close();
            //target.Connection.Close();
        }
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/net-Wrapper-quirks-tp2049912p5332595.html
Sent from the FDO Users mailing list archive at Nabble.com.


More information about the fdo-users mailing list