0

I want to display my geodata stored in ArcGIS Server. I did the connection to the server but the problem is the parameter versionName. I will not use ArcSDE so I have ignored versionName.

Can someone help me to find the solution?

ESRI.ArcGIS.GISClient.IAGSServerObject so = GetSelectedServerProxy();

ESRI.ArcGIS.GeoDatabaseDistributed.IGeoDataServer gdso = (ESRI.ArcGIS.GeoDatabaseDistributed.IGeoDataServer)so;

//++ Queries for subfields if the Get Fields checkbox is enabled
ESRI.ArcGIS.Geodatabase.IQueryFilter qf = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();

qf.WhereClause = "";

//++ based on the start index and count entered.
ESRI.ArcGIS.Geodatabase.IResultPortionInfo range = new ESRI.ArcGIS.Geodatabase.ResultPortionInfoClass();
        range.StartIndex = 0;
        range.Count = 500;
    
//++ Run a tablesearch based on the version, table name, fields selected, startindex and count
ESRI.ArcGIS.GeoDatabaseDistributed.IGDSQueryResultPortion res = gdso.TableSearch(versionName,"tabl", qf, range);
2

According to the documentation you don't need to specify the version name on non-ArcSDE data: "If the geodatabase referenced by the GeoDataServer is an ArcSDE geodatabase, then you can set the versionName parameter to the version on which to execute the query. If no versionName is provided, the version that the GeoDataServer is currently referencing is used. For non-ArcSDE geodatabases, the versionName is ignored." See: IGeoDataServer.TableSearch Method

  • thx for ur response but i don't know how to indicate that the versionName is ignored, what can in write in the property versionName – hana hana May 6 '11 at 14:19
  • Have you tried to use: null – MathiasWestin May 6 '11 at 15:03
  • yes i tried but no result – hana hana May 6 '11 at 17:55
2

The code below works for me with a geodataservice based on a file gdb.

private static void ListFields(string svcName)
{
    var conn =  new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection();
    conn.Host = "localhost";
    conn.Connect();

    var ctx = conn.ServerObjectManager.CreateServerContext(svcName, "GeoDataServer");
    var gds = ctx.ServerObject as IGeoDataServer;
    var bo = ctx.CreateObject("esriGeodatabase.DEBrowseOptions") as IDEBrowseOptions;
    bo.ExpandType = esriDEExpandType.esriDEExpandDescendants;
    bo.RetrieveFullProperties = true;
    var elements = gds.get_DataElements(bo);
    for (int i = 0; i < elements.Count; i++)
    {
        var de = elements.get_Element(i);
        var deTable = de as IDETable;
        if (deTable != null)
        {
            Console.WriteLine("{0}", de.Name);
            for (int j = 0; j < deTable.Fields.FieldCount; j++)
                Console.WriteLine("\t{0}",deTable.Fields.get_Field(j).Name);
        }
    }
    ctx.ReleaseContext();
}
  • @kirkir Kuykendall thx for ur response but i have a problem with var ctx = conn.ServerObjectManager.CreateServerContext("servicename", "GeoDataServer"); – hana hana May 9 '11 at 13:42
  • 1
    @hana "Have a problem" covers a lot of ground. What, specifically, is the problem? – whuber May 14 '11 at 18:35
  • i can't connect to the arcgis server whith ServerObjectManager.CreateServerContext i receive this error message Object reference not set to an instance of an object. – hana hana May 14 '11 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.