Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to display my geodata stored in the 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?

thx :)

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);
share|improve this question
    
What is the problem? –  whuber May 6 '11 at 13:22
    
@ whuber the problem that i haven't a versionName because i haven't arcSDE, how i can use the function tableSearch without the versionName, or what the solution ? –  hana hana May 6 '11 at 13:31
    
possible duplicate of How display fields from geodata service c# –  Kirk Kuykendall May 10 '11 at 21:08
    
yes because i don't have a solution :( –  hana hana May 10 '11 at 23:46
    
-1 It's better to update the first question instead of starting new ones. –  MathiasWestin May 14 '11 at 11:04
show 3 more comments

2 Answers

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

share|improve this answer
    
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
add comment

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();
}
share|improve this answer
    
@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
    
@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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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