当先锋百科网

首页 1 2 3 4 5 6 7

vbscript连接操作mysql

给出一段非常简单的vbscript操作mysql的脚本代码,连接其它数据库类似:

strConn="driver={mysql odbc 5.1 driver};server=192.168.1.111;database=xifeijian;port=3306;uid=root;password=root"

Set conn = CreateObject("adodb.connection")
conn.Open strConn
strSql="SELECT * FROM keyword LIMIT 10;"
Set rs = CreateObject("adodb.recordset")
rs.Open strSql, conn, 1, 3
rs.MoveFirst

Do Until rs.EOF
msgbox rs.Fields("name")
rs.MoveNext
Loop

rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing

'增、删、改
'conn.execute strSql,intRowsAffect