berush
路人甲
路人甲
  • 注册日期2003-12-01
  • 发帖数158
  • QQ
  • 铜币622枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:4399回复:18

mo的属性数据编辑~

楼主#
更多 发布于:2004-09-01 15:21
<P>就是我在地图上选中一个或多个地理目标,就会弹出它的属性框,而且可以属性编辑,但是这样的实现,好像很麻烦.首先是把取得的recordset的每个field的value填充到前面的弹出的属性框里.然后我在属性框里进行编辑.问题是编辑完,你要判断编辑框中哪条记录已经被改变了,你要相应的更改recordset中的那条记录.我想问的是大家进行mo属性编辑是不是通过此方法,还是有别的更好的方法,如果是的话大家用的属性框是用什么控件做的,而且当属性框中记录改变时是怎么对应到recordset的记录的改变.小弟的表述能力不好,不知道各位大虾看懂没~~~</P>
喜欢0 评分0
olympic0408
路人甲
路人甲
  • 注册日期2005-02-18
  • 发帖数82
  • QQ
  • 铜币378枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-05-16 17:05
<P>在点击那个段的时候,你可以从shapefile文件中读取那个ID(xx)号啊,然后修改属性记录,如果需要保存修改的记录,可以 update  ,在where ID="xx",这样可以不?</P>
=================== QQ:77837769 email:olympic0408@163.com =============
举报 回复(0) 喜欢(0)     评分
天之骄子
路人甲
路人甲
  • 注册日期2005-04-21
  • 发帖数28
  • QQ
  • 铜币208枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-05-15 10:26
<P>楼上的大大想必是已经可以开启属性数据表了</P><P>小弟目前遇到不知如何开启属性数据表的问题</P><P>不知道楼上的大大是否可以提供一点范例教学啊</P><P>感谢</P>
举报 回复(0) 喜欢(0)     评分
luongsecond
路人甲
路人甲
  • 注册日期2003-11-13
  • 发帖数35
  • QQ
  • 铜币304枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-05-04 12:13
<P>总统,我按照你方法对我的图层属性进行修改如下:</P>
<P>Public Sub addFldResult(Rs As ADODB.Recordset, lyRs As MapObjects2.Recordset)
       If Not Rs.BOF Then
          Rs.MoveFirst
       End If
       Do While (Not Rs.EOF)
          lyRs.MoveFirst
          Do While (Not lyRs.EOF)
             If Rs.Fields("图元名").Value = lyRs.Fields("name").ValueAsString Then
                lyRs.Edit
                lyRs.Fields("Result").Value = Rs.Fields("结果").Value
                lyRs.Update
                lyRs.StopEditing
                MsgBox Rs.Fields("结果").Value
                MsgBox lyRs.Fields("Result").ValueAsString
                Exit Do
             End If
             lyRs.MoveNext
          Loop
          Rs.MoveNext
       Loop
End Sub</P>

<P>可为什么我的图层属性并没有改变,两个msgbox 出来的结果不一样,打开属性数据表,也没有改变,急知道,谢谢</P>
举报 回复(0) 喜欢(0)     评分
tomas.tang
路人甲
路人甲
  • 注册日期2004-05-11
  • 发帖数113
  • QQ
  • 铜币491枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2005-01-07 20:42
<img src="http://www.gisempire.com/bbs/Skins/default/topicface/face3.gif"><img src="http://www.gisempire.com/bbs/Skins/default/topicface/face6.gif">楼上能否解决大数量属性纪录浏览?
举报 回复(0) 喜欢(0)     评分
wrbwf
路人甲
路人甲
  • 注册日期2003-12-01
  • 发帖数944
  • QQ
  • 铜币2516枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2005-01-07 12:10
<img src="images/post/smile/dvbbs/em02.gif" />
举报 回复(0) 喜欢(0)     评分
wxj1212
路人甲
路人甲
  • 注册日期2004-09-26
  • 发帖数11
  • QQ
  • 铜币159枚
  • 威望0点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2004-12-31 09:33
麻烦帝国总统一下,请告诉一个解决的办法,还有各位高手。本人在焦急的等待。
举报 回复(0) 喜欢(0)     评分
wxj1212
路人甲
路人甲
  • 注册日期2004-09-26
  • 发帖数11
  • QQ
  • 铜币159枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2004-12-30 14:37
<P>谢谢你老兄,关键是我还是搞不清楚怎样用表中的关键字确定那条记录,比如说,我点击了地图上的某一段,然后出现了相应的属性,我在对属性进行更改的时候,怎样识别要修改的纪录是刚才点击的那一段所对应的纪录。这个问题困扰我很久了,希望高手给指点一下。不知道各位大侠明白我的意思了吗?</P>
举报 回复(0) 喜欢(0)     评分
dacyhom
路人甲
路人甲
  • 注册日期2004-11-06
  • 发帖数15
  • QQ
  • 铜币168枚
  • 威望0点
  • 贡献值0点
  • 银元0个
8楼#
发布于:2004-12-30 09:41
<P>看看这段也许对你有帮助!!</P><P>This example uses the Edit method and the Updatable property in the context of a simple record editing application. The code also demonstrates how to use the CancelUpdate method to back out of making a change. In addition, the first time you change a record the code demonstrates the EditMode property. Note that the example determines the number of records by iterating through the Recordset. To try this example, paste the code into the Declarations section of a form containing a CommandButton control named Command1, a ComboBox named Combo1, a TextBox named Text1, and a Map named Map1 that has a MapLayer. For the CommandButton, set its Index property to 0 in the Control Properties dialog box to create a control array of one element, and then press F5. Choose a Field whose values you want to change. Enter the new value in the text box and press the Change button. You can iterate through the Recordset with the buttons named Next and Previous.  </P><P>Private editbufr As Variant
Private recset As MapObjects2.Recordset
Private TotalRecs As Integer</P><P>Private Sub Combo1_Click()
   Text1.Text = recset.Fields(Combo1.List(Combo1.ListIndex)).Value
End Sub</P><P>Private Sub Command1_Click(Index As Integer)
  Static recnum</P><P>  With recset.Fields(Combo1.List(Combo1.ListIndex))
    Select Case Index
      Case 0 'Next
        If recnum < TotalRecs Then
          recset.MoveNext
          Text1.Text = .Value
          recnum = recnum + 1</P><P>          Command1(1).Enabled = True
          If recnum = TotalRecs - 1 Then
            Command1(0).Enabled = False
          Else
            Command1(0).Enabled = True
          End If
          Map1.TrackingLayer.Refresh True
        End If
      Case 1 'Previous
        If recnum > 0 Then
          recset.MovePrevious
          Text1.Text = .Value
          recnum = recnum - 1
          Command1(0).Enabled = True
          If recnum = 0 Then
            Command1(1).Enabled = False</P><P>          Else
            Command1(1).Enabled = True
          End If
          Map1.TrackingLayer.Refresh True
        End If
      Case 2 'Change
        editbufr = .Value
        recset.Edit
        .Value = Text1.Text
        resp$ = MsgBox("Are you sure you want to change the value?", vbYesNo + vbInformation, "MapObjects")
        If resp$ = vbYes Then
          GetEditMode 'demonstrates EditMode property
          recset.Update
          GetEditMode
        Else</P><P>          recset.CancelUpdate
          Text1.Text = editbufr
        End If
        recset.StopEditing
    End Select
  End With
End Sub</P><P>Sub GetEditMode()
  Static Demonstrated As Integer
  If Demonstrated < 2 Then
    Select Case recset.EditMode
      Case 0
        Msg$ = "No editing operation is in progress."
        Button$ = vbInformation
      Case 1
        Msg$ = "Edit in progress"
        Button$ = vbExclamation
      Case 2
        Msg$ = "AddNew method has been invoked."</P><P>        Button$ = vbExclamation
    End Select
    MsgBox Msg$, Button$, "MapObjects"
  End If
  Demonstrated = Demonstrated + 1
End Sub</P><P>Private Sub Form_Load()
  
  For i = 1 To 2  ' Create two more instances of Command1.
    ' Set the location of the new option button.
    Load Command1(i)
    Command1(i).Top = Command1(i - 1).Top + Command1(0).Height + 40
    Command1(i).Visible = True
  Next i</P><P>  Command1(0).Caption = "Next"
  Command1(1).Caption = "Previous"</P><P>  Command1(2).Caption = "Change"</P><P>  Set recset = Map1.Layers(0).Records
  For Each f In recset.Fields
    Combo1.AddItem f.Name
  Next f
  Combo1.ListIndex = 0
  
  'count the number of records
  ctr = 0
  Do While Not recset.EOF
    TotalRecs = TotalRecs + 1
    recset.MoveNext
  Loop</P><P>  recset.MoveFirst
  Text1.Text = recset.Fields(Combo1.List(Combo1.ListIndex)).Value
  Command1(1).Enabled = False
  If Not recset.Updatable Then
    Command1(2).Enabled = False</P><P>  End If
End Sub</P><P>Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As Stdole.OLE_HANDLE)
  Map1.FlashShape recset.Fields("Shape").Value, 3
End Sub</P><P> 我也遇到你类似的问题,把这段代码改改,就行了。重要的是用表中的关键字确定修改那条记录。</P><img src="images/post/smile/dvbbs/em08.gif" />[<img src="images/post/smile/dvbbs/em07.gif" />
举报 回复(0) 喜欢(0)     评分
wxj1212
路人甲
路人甲
  • 注册日期2004-09-26
  • 发帖数11
  • QQ
  • 铜币159枚
  • 威望0点
  • 贡献值0点
  • 银元0个
9楼#
发布于:2004-12-29 20:18
<P>怎么没有回音阿,帝国总统是不是这几天没来,小弟急等着呢!!!</P>
举报 回复(0) 喜欢(0)     评分
上一页
游客

返回顶部