MariaDB社区

标题: 如何在VB中创建与Mysql 5.1的链接表?代码如下: [打印本页]

作者: feifeima2008    时间: 2009-8-17 01:10
标题: 如何在VB中创建与Mysql 5.1的链接表?代码如下:
本帖最后由 feifeima2008 于 2009-8-17 01:11 编辑

Dim catDB As ADOX.Catalog
   Dim tblLink As ADOX.Table
   Set catDB = New ADOX.Catalog

   Dim cn As New ADODB.Connection
   
   cn.Open "rovider=Microsoft.Jet.OLEDB.4.0;" & _
         "Data Source=" & App.Path & "\newtest.mdb"
   'Link the Orders_Table in the Workbook to the Access Northwind Database.
   'The name of the linked, or attached table, in NorthWind will be "LinkedXLS"
'   catDB.ActiveConnection = "rovider=Microsoft.Jet.OLEDB.4.0;" & _
'         "Data Source=" & App.Path & "\newtest.mdb"
         
   Set catDB.ActiveConnection = cn
   
   Set tblLink = New ADOX.Table
   With tblLink
      .Name = "rocPipeTbl000"
      Set .ParentCatalog = catDB
      .Properties("Jet OLEDB:Create Link") = True
      .Properties("Jet OLEDBink Provider String") = _
            "ODBC;DRIVER={MySQL ODBC 5.1 Driver};SERVER=localhost;DATABASE=PubSpec;UID=XXXX;PWD=XXXX;OPTION=3;charset=gbk"
      .Properties("Jet OLEDB:Remote Table Name") = "procpipetbl"
   End With
   
  ' On Error Resume Next
   catDB.Tables.Append tblLink  '<---代码至此失败,产生错误“ODBC--调用失败"
   
  ' Set cn = catDB.ActiveConnection
   
   cn.Execute "Select * into ProcPipeTbl from ProcPipeTbl000"
   
   Set tblLink = Nothing
   cn.Close
   Set catDB = Nothing

   本人使用最新的msJet40.dll 最新版,MySql网站说的解决方法不行


本人的 email:feifeima2008@gmail.com




欢迎光临 MariaDB社区 (http://123.56.88.72/) Powered by Discuz! X3.2