用脚本来访问数据库
'此文介绍了用脚本来访问SQL SERVER数据库的一个例子,主要是讲在PD中VB SCRIPT的用法,它和其它的脚本基本上没有什么差别。
Option Explicit
Const CONNECTION = "Provider=SQLOLEDB;Data Source=qiubole;User Id=sa;Password=;"
Dim cnx
set cnx = CreateObject("ADODB.Connection")
cnx.Open CONNECTION
Dim rs ' recordset
set rs = cnx.Execute("select name as table_name from sysobjects where xtype = 'u'")
Output "List of non-empty tables:"
Do Until rs.EOF
Output "表名"&rs("table_name")
rs.MoveNext
Loop
rs.Close
set rs = Nothing
cnx.Close
set cnx = Nothing