2012-01-01 102 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