使用纯 vbscript 连接到 mysql 5.0 数据库?
我已经尝试了以下脚本,但出现错误:
I've tried the below script but I am getting an error:
dim cn, rs
set cn = CreateObject("ADODB.Connection")
set rs = CreateObject("ADODB.Recordset")
cn.connectionstring = "Provider=MysqlProv; Data Source=Adonis; User Id=mysqluser; Password = mysqlpass;"
cn.open
rs.open "select * from Countries", cn, 3
rs.MoveFirst
while not rs.eof
wscript.echo rs(0)
rs.next
wend
cn.close
wscript.echo "End of program"
它给出了以下错误:
C:mysql.vbs(6, 1) ADODB.Connection: Provider cannot be found. It may not be pro
perly installed.
当我在谷歌上搜索 odbc 连接器时,我想到了这个 可以下载 odbc 5.1 连接器的页面.想知道这是否足以连接到 mysql server 5.0 数据库...?
When I googled for an odbc connector I came up to this page where I could download the odbc 5.1 connector. Wondering if this is enough to connect to a mysql server 5.0 database...?
推荐答案
安装 MySQL Connector/ODBC 并使用连接字符串,如下所示
Install MySQL Connector/ODBC and use a connection string like the following
connectionString = "Driver={MySQL ODBC 5.1 Driver};Server=yourServerAddress;" & _
"Database=yourDataBase;User=yourUsername;" & _
"Password=yourPassword;"
相关文章