activex script

  • I am trying to create a text file using an Activex Script in SS2005.  However, when I try and add the job, which runs correctly when used as a .vbs file, it won't compile the script and says "the command script does not destroy all the objects it creates".

    However, i really can't see where this is happening.  Below is the code it fails on:

    --

    Function loadTemplate(strTemplateFile)

    Dim strText, objFSO, objFile

    Set objFSO = createObject("scripting.fileSystemObject")

    On Error Resume Next

    Set objFile = objFSO.openTextFile(strTemplateFile)

    If err Then response.write(err.Description)

    On Error Resume Next

    strText=objFile.ReadAll

    If err Then response.Write(err.Description & " reading file")

    objFile.Close

    Set objFile = Nothing

    Set objFSO = nothing

    loadTemplate=strText

    End Function

    --

    Anyone see where I'm going wrong

  • Well, first of all, response.write is not valid in a .vbs file. Are you sure you didn't take that from ASP code?


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • yes indeed it is and I found out the reason why the script wouldn't compile as well.  apparently a script can only be 3200 nvarcar and my script was over that limit.  Got it sorted, so thanks for your reply

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply