⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 实现SDE图层和数据表的动态关联,时时更新
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "Mo20.ocx"
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5325
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   8625
   LinkTopic       =   "Form1"
   ScaleHeight     =   5325
   ScaleWidth      =   8625
   StartUpPosition =   3  'Windows Default
   Begin MapObjects2.Map Map1 
      Height          =   5235
      Left            =   45
      TabIndex        =   0
      Top             =   45
      Width           =   6990
      _Version        =   131072
      _ExtentX        =   12330
      _ExtentY        =   9234
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "Form1.frx":0000
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim dc As New MapObjects2.DataConnection

Private Sub Form_Load()
    dc.Server = "SDE91:readearth"
  dc.User = "sde"
  dc.Password = "110"
  dc.Database = "instance=port:5152"

  
  Dim pTable As New MapObjects2.Table
  Dim recLayer As MapObjects2.Recordset
    
    With pTable
        .Server = "sde91:readearth"
        .Database = "instance=port:5152"
        .User = "sde"
        .Password = "110"
        .Name = "dbo.v_booster"
    End With
    
     pTable.MaxCachedRelateRecords = 100
    
     
    
    
  If dc.Connect Then
    
     Dim layer As New MapObjects2.MapLayer
    layer.GeoDataset = dc.FindGeoDataset("PDGAS.SDE.TIAOYAQI.SHAPE.Points")
    Me.Map1.Layers.Add layer
    If Not layer.AddRelate("编号", pTable, "AddNum", True) Then
        MsgBox "no"
    End If
    
    Set recLayer = layer.Records
    recLayer.MoveFirst
    Dim i As Integer
    Dim pField As MapObjects2.Field

    For Each pField In recLayer.Fields
        Debug.Print pField.Name

    Next
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -