Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

No Timeout on DTS

Status
Not open for further replies.

brattin

Programmer
Sep 21, 2005
1
US
I've got a script that queries the database via a command, updates a text file, and then emails the file. I've got a timeout set to 200, but once and a while it will run for days without timeing out. Can any body spot the issue?...Here's the basic code...

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************


Function Main()

Dim i,Conn,RS


Set Conn = CreateObject("ADODB.Connection")
Conn.CommandTimeout = 200
Set objCmd = createobject("ADODB.Command")

Source=ConnectionString
Conn.Open (ConnectionString)

set objCmd.activeconnection = Conn
objCmd.CommandTimeout = 200
objCmd.CommandText = "sp_myproc"
objCmd.CommandType = &H0004

objCmd.Parameters.Append objCmd.CreateParameter("@var1", 5, &H0004, 3) 'double return

Set RS = objCmd.Execute
Set RS = RS.NextRecordset

wVar1 = objCmd.Parameters("@cnt_var1").Value

Conn.close
set Conn = nothing
set RS = nothing
set objCmd = nothing


Set objFSO = CreateObject("Scripting.FileSystemObject")
wPath = mypath
Set TargetFile = objFSo_OpenTextFile (wPath,8 ,True)


TargetFile.Write (wVar1 )
TargetFile.close

Set TargetFile = nothing
set objFSO = nothing

Dim objCDO
Set objCDO = CreateObject("CDO.Message")
if isobject(objCDO) then
objCDO.To = "me@mydomain.com"
objCDO.From = "me@mydomain.com"
objCDO.AddAttachment(mypath)

objCDO.Configuration.Fields.Item (" = 2
objCDO.Configuration.Fields.Item (" = "myip"
objCDO.Configuration.Fields.Item (" = 25
objCDO.Configuration.Fields.Update
'objCDO.Send
Set objCDO = Nothing
else
msgBox "mail Error: "
end if





Main = DTSTaskExecResult_Success
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top