[fdo-users] RE: .net Wrapper quirks
Bohne
thomas_bonsiepen at web.de
Sat Jul 24 06:02:57 EDT 2010
Hi Jacky,
thanks for your reply.
I modified my code but still no luck. Even if I'm adding only one integer
value to my Insertcommand (without reading from source) i'm getting this
Exception ( less than before, but still there) ??
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
using (IInsert insert =
target.Connection.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Insert)
as IInsert)
{
//setting featureClassName
insert.SetFeatureClassName(target.getFeatureClassName());
//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( insert, source,
sourceReader, target.MyFeatureClass, graphics, counter);
insert.PropertyValues.Add(new PropertyValue("MOVEID",
new Int32Value(counter)));
//
if (writeRecord)
{
//Executing InsertCommand
using (IFeatureReader insertReader =
insert.Execute())
{
insertReader.Close();
}
}
counter++;
}
}
}
source.Connection.Close();
target.Connection.Close();
}
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/net-Wrapper-quirks-tp2049912p5332467.html
Sent from the FDO Users mailing list archive at Nabble.com.
More information about the fdo-users
mailing list