I'm still a bit new to ArcObjects and was having some trouble figuring out how to write to my SDE database. What I basically am doing is taking a KML file reading it into a GDB folder on my local machine and then trying to take that data and pass it along to the SDE database. There may be some intermediate processing between grabbing the data and putting into the SDE database in the future but for now I'm just trying to copy over. So everything is working great except I can't figure out how to transfer my data from my FeatureWorkspace into my SDE Workspace.My code is below if anyone could give me a hand I would very much appreciate it!//open the database created by the KMLToLayer tool in a workspace
IWorkspaceFactory2 kmlWorkspaceFactory = new FileGDBWorkspaceFactoryClass();
IFeatureWorkspace kmlWorkspace = (IFeatureWorkspace)kmlWorkspaceFactory.OpenFromFile(path + "\\NWS_Warnings.gdb", 0);
IQueryFilter qry = new QueryFilterClass();
qry.WhereClause = "OID > 0";
IFeatureClass ifc = kmlWorkspace.OpenFeatureClass("Placemarks_line");
Console.WriteLine("[Message]: Selected featureclass Placemarks_line.");
/*IFeatureCursor features = ifc.Search(qry, false);
int nameFieldIndex = features.FindField("OID");
IFeature cur;
while ((cur = features.NextFeature()) != null)
{
Console.WriteLine("OBJECTID = " + cur.get_Value(nameFieldIndex));
}*/
try
{
//initialize sde connection
IGeoDataServer sdeServer = InitGeoDataServerFromConnectionString("SERVER=192.168.1.107;INSTANCE=5151;VERSION=SDE.DEFAULT;USER=sde;PASSWORD=Try_n0w!;DATABASE=SDESQL");
IGeoDataServerObjects gsobj = sdeServer as IGeoDataServerObjects;
IWorkspace pWorkspace = gsobj.DefaultWorkingWorkspace;
ITable table = ifc as Table;
//Start Editing
IWorkspaceEdit wspEdit = pWorkspace as IWorkspaceEdit;
wspEdit.StartEditing(false);
wspEdit.StartEditOperation();
//sdeServer.
}
catch (Exception e)
{
Console.WriteLine("[Error]: Could not establish a connection to the ArcSDE server.");
Console.WriteLine(e.ToString());
}
It's kind of a work in progress since I'm a bit stumped right now. I'm not actually getting any errors.