One way to migrate SQL Server 7.0 data to MySQL

Source: Internet
Author: User

How to migrate data from Microsoft SQL Server 7.0 to MySQL
Zhbforce
I think everyone is fond of Word typing, Excel computing and planning, and PowerPoint slides ..., However, this only applies to a few functions of Office products. According to the survey, most users only use 20% of the functions of Office products, and few people have noticed Visual Basic for Application. In fact, being familiar with the functions of VBA can help you get twice the result with half the effort. Especially for accounting, finance, and other majors, making a set of good macros can almost always be done once and for all! Recently, the VBA function has been added to AutoCAD. This is a trend!
The functions of VBA are not only troublesome for virus makers. While VBA can be used to create viruses, it also shows that it is powerful and easy to use! Using ADO objects, you can easily perform database operations! The following is an example of a simple data exchange:
Since the ADO object does not directly support MySQL, you must first install MyODBC, which is also a free product. It has been downloaded from www.mysql.org and MyODBC has been installed, you can configure a data source name in ODBC Data Source Management to point it to the MySQL database you want to connect. The Code is as follows:
Sub connectMySQL ()
'Use MyODBC to connect to the MySQL database and
'Data is transferred to mysql
Dim sConnect As String, sSql As String, I As Long
Dim cnMSSQL As New ADODB. Connection
Dim cnMySQL As New ADODB. Connection
'Declare and create object connection
Dim rs As New ADODB. Recordset 'declares and creates an object record set
Dim cm As New ADODB. Command 'declares and creates an object Command

SConnect = "dsn = mysql1" 'specifies the MySQL Data Source Name
CnMySQL. Open sConnect connect to mysql

SConnect = "Provider = SQLOLEDB.1; Persist Security Info = False; User ID = sa; pwd = 123456; Initial Catalog = softdown; Data Source = ntserver"
'Connect to 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)" 'create a new MySQL Data Table statement
SSql = "select * from softinfo order by softnum"
Rs. Open sSql, cnMSSQL, 1, 1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.