袁绍伦
路人甲
路人甲
  • 注册日期2003-08-08
  • 发帖数654
  • QQ164646905
  • 铜币1336枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1344回复:0

Visual Basic Example of an ODBC Dataset

楼主#
更多 发布于:2003-09-03 21:46
Private Sub Command1_Click()
 On Error GoTo MapXErr
 Dim ds As Dataset
 Dim parm as New ODBCQueryInfo ' You will need to include the
           ' Mapinfo ODBC Dataset engine library

 parm.SqlQuery = "select * from USA"
 ' if the ConnectString is left blank, the user will be
 ' prompted to find a driver and data source. This can include
 ' uid=, pwd=, and dlg= fields.
 ' Change the DBQ= line if MapX was installed in another
 ' location.
 parm.ConnectString = "ODBC;DRIVER={Microsoft Access Driver (*.mdb)};" & _

"DBQ=C:\Program Files\MapInfo\MapX 5.0\Data\MapStats.mdb;"

 ' Rather than providing connection information in the connect
 ' string, a named data source can be created in the ODBC Data
 ' Sources Control Panel and used here.
 parm.DataSource = ""

 ' Add the Dataset.
 Set ds = Map1.Datasets.Add(miDataSetODBC, parm, "ODBC Dataset")

 'Create the default theme on the dataset
 ds.Themes.Add
 Exit Sub
MapXErr:
 MsgBox "Error #" & Err.Number & ": " & Err.Description

End Sub

喜欢0 评分0
愿意和大家交朋友! QQ:47559983 MSN:shaolun_yuan@hotmail.com eMail:shaolun-yuan@163.com
游客

返回顶部