Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Mail Que System

Author  Topic 

skillile
Posting Yak Master

208 Posts

Posted - 2002-04-09 : 13:25:38
I have read the Mail Que article and the comments on the error generated when trying to schedule. I am trying to place into DTS as an AX script. Here is my code


'******************************************************
'this procedure retrieves and sends mail
'******************************************************
'--------------------
'ADO Constants
const adCmdStoredProc = &H0004
'--------------------
'System config

const strconn="Provider=SQLOLEDB.1;xxxx


call main
Sub main()

dim objcmd
dim objrs
dim mailarr
dim x

Set objcmd=server.createobject("ADODB.command")

With objcmd
.activeconnection=strconn
.commandtext = "ps_email_send"
.commandtype = adcmdstoredproc
Set objrs=objcmd.execute
End with


If not objrs.eof then
mailarr =objrs.getrows
End If

Set objrs=nothing
Set objcmd=nothing
Set strconn=nothing

if isarray(mailarr) then
For x=0 to ubound(mailarr,2)

'call mail sub
call sendmail(mailarr(2,x), mailarr(4,x), mailarr(5,x), mailarr(6,x))

next

if isarray(mailarr) then
erase mailarr
end if


end if

end sub

sub sendmail(toemail, fromemail,subject, body)
dim myMail
'send mail

set myMail = createobject("CDONTS.NewMail")

myMail.From = fromemail
myMail.to=toemail
myMail.Subject = subject
myMail.BodyFormat=0
myMail.MailFormat=0
myMail.Body = body
myMail.send

Set myMail=nothing

end sub


slow down to move faster...

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-04-09 : 17:18:26
Is there a question in here? Or are you submitting this as your solution to the problem, and it should be stored in the Script Library? What is this?

------------------------
GENERAL-ly speaking...
Go to Top of Page

skillile
Posting Yak Master

208 Posts

Posted - 2002-04-09 : 21:53:19
Yeah, sorry I was looking at the thread and ran into the same problem as others with the error. The solution was to go convert the proc to DTS with some adjusted code.

I was looking for the DTS solution if anyone had it handy.

Sorry for the confusion.



slow down to move faster...
Go to Top of Page
   

- Advertisement -