suoermap的object.net循环遍历属性表,从数据库取数据进行更新属性字段值

 1 /// </summary>
 2         /// <param name="sName">图层名</param>
 3         /// <param name="stationID">测站编码</param>
 4         /// <param name="evalue"></param>
 5         public static void QueryLayerAttribute(string sName,string stationID,double evalue)
 6         {
 7             if (null!=sName)
 8             {
 9                 Layer layer = m_mapControl.Map.Layers[sName];//获取图层
10                 if(null!=layer)
11                 {
12                     DatasetVector dataset = layer.Dataset as DatasetVector;
13                     Recordset recordset = dataset.GetRecordset(false, CursorType.Dynamic);
14                     recordset.MoveFirst();
15                     if (null != dataset)
16                     {
17                         for (int i = 0; i < recordset.RecordCount; i++)//遍历属性表
18                         {
19                             string station = recordset.GetFieldValue("stationID").ToString();
20 
21                             if (stationID == station)
22                             {
23                                 recordset.Edit();
24                                 recordset.SetFieldValue("eValue", evalue);
25                                 recordset.Update();
26                                 return;
27                             }
28                             recordset.MoveNext();
29                         }
30 
31                     }
32                 }
33             }
34             m_mapControl.Refresh();
35         }

 

posted @ 2018-05-10 15:53  风轻云淡wjr  阅读(145)  评论(0编辑  收藏  举报