Select to view content in your preferred language

Problem adding features

2610
1
04-26-2012 10:53 AM
MarkCederholm
Regular Contributor II
I have an empty point feature class and I add a feature using the following code:

   tab = gdb.OpenTable("\\" + sClassName);
   row = tab.CreateRowObject();
   row.SetString("TITLE", "Hwy 69/access road");
   row.SetString("DETAIL", "there is no valve here");
   pt = new Point(1239977, 12558523);
   pb = new PointShapeBuffer();
   pb.Setup(ShapeType.Point);
   pb.point = pt;
   row.SetGeometry(pb);
   tab.Insert(row);
   tab.Close();


I can read the feature just fine using the following code:

   tab = gdb.OpenTable("\\" + sClassName);
   foreach (Row r in tab.Search("*", "1 = 1", RowInstance.Recycle))
   {
    pb = r.GetGeometry();
    pt = pb.point;
    Console.WriteLine("x=" + pt.x.ToString() + ",y=" + pt.y.ToString());
    string s = r.GetString("TITLE");
    Console.WriteLine("TITLE=" + s);
    s = r.GetString("DETAIL");
    Console.WriteLine("DETAIL=" + s);
   }
   tab.Close();


But when I try to preview the feature class in ArcCatalog or open it in ArcMap (10.0SP4), I get "Error opening feature class, General function failure".  Any idea what I might be doing wrong? (I'm using API 1.2)
0 Kudos
1 Reply
MarkCederholm
Regular Contributor II
I figured out what was going on.  The file geodatabase in question was upgraded from v9.  I copied the schema into a feshly created one and the problem went away.  Yet more proof that the geodatabase upgrade tool is messed up.
0 Kudos