MySQL到MS Access [英] MySQL to MS Access

查看:73
本文介绍了MySQL到MS Access的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我们一直在从远程MS Access数据库中检索数据,然后使用简单的SELECT * INTO查询将其内容复制到本地Access DB中.但是,我们目前正处于迁移过程中,该过程需要从MySQL数据库检索数据并将其复制到本地Access DB,因此,出于显而易见的原因,上述查询在这里将无法正常工作.

For some time we've been retrieving data from a remote MS Access database and copy its contents to a local Access DB with a simple SELECT * INTO query. However we're currently in a migration process which requires to retrieve data from the MySQL database and copy it to the local Access DB, thus the aforementioned query won't work here for obvious reasons.

现在看到我不能使用任何外部程序,并且只允许在VB.NET中进行写操作,因此我用来传输数据的方法是使用数据表.它尽其所能,但性能令人恐惧.

Now seeing as I can't use any external programs and are only allowed to write in VB.NET, my method to transfer the data over is by using datatables. It does its job, but the performance is dreadful.

因此,我的问题是,是否有一种仅使用VB.NET将数据从远程MySQL数据库传输/复制到本地MS Access的快速方法.

My questions therefore is, is there a fast way to transfer/copy data from the remote MySQL database to a local MS Access with only using VB.NET.

我当前的代码:pastebin.com/ELmkVFSc

My current code: pastebin.com/ELmkVFSc

推荐答案

非常粗略:

Imports Microsoft.Office.Interop.Access.Dao

Module Module1

    Sub Main()
        Dim dbEng As New DBEngine()
        Dim ws As Workspace
        Dim db As Database
        ws = dbEng.CreateWorkspace("", "admin", "", WorkspaceTypeEnum.dbUseJet)
        db = ws.OpenDatabase("z:\\docs\\test.accdb", False, False, "")
        db.Execute("SELECT * INTO Newtable From [ODBC;DSN=MySQL;].test")

    End Sub

End Module

您还可以在以下几行中查询:

You could also have a query on these lines:

SELECT * INTO Newtable FROM
[ODBC;Driver={MySQL ODBC 5.1 Driver};Server=127.0.0.1;Database=test;User=usr;Password=pwd;CLIENT_MULTI_RESULTS;Option=3;].test;

这篇关于MySQL到MS Access的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆