sportdog

导航

 

LeaveConfig是字典表,通过某个编码获取该编码对应的值,可输入编码做为查询条件查不到记录.原因为编码是字段显示的名称而不是字段的名称

编码 审批人
HrUser sportdog

 

SPSite site = new SPSite("http://gwsps03");
            SPWeb web = site.OpenWeb();
            SPList lists = web.Lists.TryGetList("LeaveConfig");
            SPQuery query = new SPQuery();
            query.Query = "<Where><Eq><FieldRef Name='_x7f16__x7801_'/>" +
                "<Value Type='Text'>HrUser</Value></Eq></Where>";
            SPListItemCollection items = lists.GetItems(query);
            Response.Write(items.Count + items[0]["审批人"].ToString());

From MSDN:

SPField.StaticName 属性
Gets or sets the internal name of the field.
属性值
A string that specifies the internal name of the field.

SPField.InternalName 属性
Gets the internal name that is used for the field.
属性值
A string that contains the internal name.

SPField.Title 属性
Gets or sets the display name for the field.
属性值
A string that contains the display name.

所以:

StaticName和InternalName的区别,应该是InternalName是read-only,而StaticName不是。

posted on 2013-04-01 22:20  sportdog  阅读(197)  评论(0)    收藏  举报