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)
 Activex script not working

Author  Topic 

brownd92
Starting Member

8 Posts

Posted - 2005-03-15 : 10:31:17
Here is the script.
All the records in the database are being updated instead of just the records in the database.
Any Ideas?

''''''''''''''''''''''''''''''''''''''''''
Option Explicit

On Error Resume Next

Function Main()

Dim SentTime

'set SentTime = now()

'set senttime = day & Month & Year

Dim strEmailBody
Dim iMsg
Dim oRS
Dim objMail
Dim oRsC

Set oRs=DTSGlobalVariables("RSGetNotSent").Value

While Not oRS.EOF

dim myDestConn
Dim myDestSQL

Set iMsg = CreateObject("CDO.Message")
Set objMail = CreateObject("CDO.Message")

' Move to the next row in preparation for loop iteration

'Create the body of the email
strEmailBody = "Good morning," & vbCrLf & _
"You have outdated content to update " & _
" Please click on this link to rectify " & _
"http://www.bustedmedia.com."
'
'Attach the file to an email and send it
objMail.From = " youremail@email.com"
objMail.To = oRS.Fields(3).Value
objMail.Subject = "Content needing attention"
objMail.TextBody = strEmailBody
objMail.Send
Set objMail = nothing


set myDestConn = CreateObject("ADODB.Connection")
myDestConn.Open = "Provider=SQLOLEDB.1;Data Source=(local); Initial Catalog=test;user id = 'obtree';password = 'obtree'"
'myDestSQL = "Update ObtreeEmail set emailStatus = 1, senttime=" & now() & " Where id =" & oRS.Fields(0).Value

myDestSQL = "Update ObtreeEmail set emailStatus = 1 Where id =" & oRS.Fields(0).Value
myDestConn.Execute myDestSQL

set myDestConn = nothing

oRS.MoveNext

wend

Set oRS = Nothing
Set oRsC = Nothing

Main = DTSTaskExecResult_Success

End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''

Cheers
   

- Advertisement -