vb+MAPX 数据绑定
Private Sub Command5_Click()
Dim dataset As MapXLib.dataset
Dim BindLyr As New MapXLib.BindLayer
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSql As String
'打开mdb数据库
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
conn.open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & App.Path & "\data\pccw.mdb"
strSql = "select * from BINDLAYERXY"
rs.open strSql, conn, adOpenStatic, adLockReadOnly
'绑定,引入ACCESS数据源
BindLyr.LayerType = miBindLayerTypeXY
BindLyr.RefColumn1 = "MI_SQL_X"
BindLyr.RefColumn2 = "MI_SQL_Y"
Set dataset = Map1.DataSets.Add(miDataSetADO, rs, , "MI_SQL_X", "MI_SQL_Y", BindLyr)
' '生成专题图
' Dim cols(1 To 2) As String
' cols(1) = "popnum"
' cols(2) = "income"
' dataset.Themes.Add miThemeBarChart, cols
rs.Close
Set rs = Nothing
end sub