cheerlate 2017-03-21 02:54 采纳率: 0%
浏览 1159
已结题

Arcgis server SOE值不在预期范围内

是这样的,我搭建了SOE服务,其他一切都还好,现在我想做一个输入图层ID和要素ID能查询相对应的值的。下面是核心的代码
JsonObject result = new JsonObject();
result.AddLong("图层ID",layerid);
result.AddLong("要素ID", featureid);
result.AddArray("所有属性", pJsonObject.ToArray());
//return Encoding.UTF8.GetBytes(result.ToJson());

        for (int j = 3;j<=m_Fields.FieldCount;j++)
        {
            m_Field = m_Fields.get_Field(j);
            if (m_Field.VarType == 5)
            {
                object m_value = m_Row.get_Value(j);
                Double m_value2 = (Double)m_value;
                result.AddDouble(m_Field.Name, m_value2);                                       
            }
            else if (m_Field.VarType == 8)
            {
                object m_value = m_Row.get_Value(j);
                string m_value2 = (string)m_value;
                result.AddString(m_Field.Name, m_value2);
            }
            else if (m_Field.VarType == 3)
            {
                object m_value = m_Row.get_Value(j);
                int m_value2 = (int)m_value;
                result.AddLong(m_Field.Name, m_value2);
            }
            else
            {
                result.AddString("其他类型", "具体是啥不想写了");

            }

        }
        return Encoding.UTF8.GetBytes(result.ToJson());

我调试了一下代码,发现最后这一句死活都传不进去,也就是没有执行这一句,但是把for循环取消了就没有影响了。实在是很费解。。。身边也没有懂的人。


  • 写回答

2条回答 默认 最新

  • threenewbee 2017-03-21 03:53
    关注

    m_Field = m_Fields.get_Field(j);
    这种代码都从哪里来的,在C#应该写 m_Field = m_Fields[j];

    评论

报告相同问题?