Heim  >  Artikel  >  Backend-Entwicklung  >  SQL Server 7.0 的数据迁移到MySQL上的一种方法_PHP教程

SQL Server 7.0 的数据迁移到MySQL上的一种方法_PHP教程

WBOY
WBOYOriginal
2016-07-13 17:01:02718Durchsuche

Microsoft SQL Server 7.0 的数据迁移到MySQL上的方法
Zhbforce
想必大家都很喜欢用Word打字,用Excel进行计算和规划,用PowerPoint作幻灯片进行展示…,但是这只用到了Office系列产品的很少的一部分功能。据调查,绝大部分用户只用到了Office产品的20%的功能,很少有人注意到Visual Basic for Application。实际上,熟悉掌握VBA的功能可以使你的工作事半功倍,尤其对会计、金融等专业来说,作出一套好的宏,几乎可以作到一劳永逸!最近,AutoCAD中也加入了VBA的功能,这不能不说这是一个趋势!
VBA的功能决不只是让病毒制造者用来制造麻烦的,VBA能被用来制造病毒的同时也正说明了其功能的强大与易用!利用ADO对象,可以很方便的进行数据库操作!下面就是一个简单的数据交换的例子:
由于ADO对象不直接支持MySQL,所以必须先安装MyODBC, 后者也是一个免费产品,在www.mysql.org上有下载,安装好了MyODBC, 就可以在ODBC数据源管理中配置一个数据源名称,把它指向你想连接的MySQL数据库。代码如下:
Sub connectMySQL()
'通过MyODBC去连接MySQL数据库,并将Microsoft SQL Server 7
'的数据转进mysql中
Dim sConnect As String, sSql As String, i As Long
Dim cnMSSQL As New ADODB.Connection
Dim cnMySQL As New ADODB.Connection
'声明并创建对象 连接
Dim rs As New ADODB.Recordset '声明并创建对象 记录集
Dim cm As New ADODB.Command '声明并创建对象 命令

sConnect = "dsn=mysql1" '指定MySQL的数据源名称
cnMySQL.Open sConnect '连接到 mysql

sConnect="Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;pwd=123456;Initial Catalog=softdown;Data Source=ntserver"
'连接到 ms sql server 7
cnMSSQL.Open sConnect

'sSql = "create table softinfo (softNum smallint,softname varchar(70),softdesc blob," & _
"softpath varchar(30),softleng varchar(10),softclass varchar(10),softsugest tinyint(1)," & _
"softdown smallint(4))" '创建新的MySQL数据表语句
sSql = "select * from softinfo order by softnum"
rs.Open sSql, cnMSSQL, 1, 1

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/631203.htmlTechArticleMicrosoft SQL Server 7.0 的数据迁移到MySQL上的方法 Zhbforce 想必大家都很喜欢用Word打字,用Excel进行计算和规划,用PowerPoint作幻灯片进行展示…,...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn