[fdo-users] SDF Example for Insert , Update, Read
raghulan
neo.exterminator at gmail.com
Wed Oct 10 21:58:58 PDT 2012
Greg,
Thanks for the help..I made some progress...
here is my code snippet..please let me know where I am getting it
wrong...(Once I get it right sure i want to post some tutorials for basics)
My schema Structure (SDF File)
====================================================
Schema name: Civil_schema
Feature classes : Pipes, structure, point, ...
properties inside Pipes feature class : PipeRadius, PipeType,....
====================================================
Now that I have the schema, I have two pipe data inside (two rows - PipeName
= p1 and p2)
I want to insert PipeType as Iron for R-1P1 and PVC for R-1P2
for some reason my insert and update command isnt working...
Code snippet
====================================================
//static sdf file
string sdffile = "c:\test.sdf";
//created a IConnection con (i have this in correct - just dont want to
write all)
using(con)
{
using (osgeo_command.Feature.IUpdate update_data =
con.CreateCommand(osgeo_command.CommandType.CommandType_Update) as
osgeo_command.Feature.IUpdate)
{
//set the target schema
update_data.SetFeatureClassName("Civil_schema:Pipes"); //schema
name:clas name = this worked for reading
update_data.SetFilter("Name = R-1P1"); // this is to identify
the row - i am not going to update this row
// property value collection
PropertyValueCollection pcoll = update_data.PropertyValues;
//creating a property value that needs to be added
PropertyValue propvalue = null;
propvalue = new PropertyValue();
ValueExpression expression =
(ValueExpression)Expression.Parse("'Iron'"); //want to add iron as my pipe
type
propvalue = new PropertyValue("Pipetype", expression);//here i
am specifying the column name as Pipetype
pcoll.Add(propvalue);
if (1 != update_data.Execute())
{
ed.WriteMessage("\nUpdate failed");//this writes the
message in autocad
}
}
}
==============================================================
I dont know where i am going wrong...could you guys point me the correct
direction please..
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/SDF-Example-for-Insert-Update-Read-tp5007560p5007901.html
Sent from the FDO Users mailing list archive at Nabble.com.
More information about the fdo-users
mailing list