vb+MAPX 数据绑定

前端之家收集整理的这篇文章主要介绍了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

猜你在找的VB相关文章