您好我有我的vbs腳本通過執行xp_sendmail來發送電子郵件。在vbs中調用xp_sendmail時出錯
ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=master;Data Source=myserver"
Set dbconn = CreateObject("ADODB.Connection")
dbconn.Open ConnectionString
DIM cmd
SET cmd = CreateObject("ADODB.Command")
SET cmd.ActiveConnection = dbconn
cmd.CommandText = "xp_sendmail"
cmd.CommandType = 4 'adCmdStoredProc
Dim email = "[email protected]"
Dim subj = "test"
Dim msg = "message"
cmd.Parameters("@Recipients") = email
cmd.Parameters("@Subject") = subj
cmd.Parameters("@message") = msg
cmd.Execute
這給上線的錯誤:
Dim email = "[email protected]"
Error: Expected end of element. Any help would be appreciated.
如果您刪除'adCmdStoredProc? –
'Dim email' and another line'email =「[email protected]」' – 2016-07-26 04:45:35
嗨@noodles,我試過了你的建議,但現在它給了我一個錯誤:找不到對應於請求的名稱的集合中的項目或序。 line:cmd.Parameters(「@ Recipients」)=電子郵件 –