2012-01-01 70 views
1

我有这个脚本在我的托管服务器上,并从plesk调度器返回结果到服务器,因为这只是excecuting,如何回声结果,所以plesk发送给我的输出?Vb脚本数据库回声结果

Const DB_CONNECT_STRING = "Provider=SQLOLEDB.1;Data Source=server;Initial 
Catalog=db;user id ='user';password='password'" 
Set myConn = CreateObject("ADODB.Connection") 
Set myCommand = CreateObject("ADODB.Command") 
myConn.Open DB_CONNECT_STRING 
Set myCommand.ActiveConnection = myConn 
myCommand.CommandText = "select COUNT (*) FROM [Table].[dbo].[User]" 
myCommand.Execute 

myConn.Close

回答

0

这可能会实现:

... 
myCommand.CommandText = "select COUNT (*) AS CNT FROM [Table].[dbo].[User]" 
myCommand.Execute 

Do Until myCommand.Eof = True 
    WScript.echo myCommand("CNT") 
    myCommand.MoveNext 
Loop 

myConn.Close 

我提到以下(日语)的页面:

http://www.happy2-island.com/vbs/cafe02/capter00604.shtml