Invoking ADO from an ActiveX Script

This sample demonstrates how you can use the DTS GlobalVariables collection to invoke ADO objects, methods, and properties from within a DTS Microsoft® ActiveX® script.

Function Main()

  

    DTSGlobalVariables("adoConnection").Value =
        CreateObject("ADODB.Recordset")

    DTSGlobalVariables("adoConnection").Value.Open "select * from
        authors", _

    "DRIVER={SQL Server};Server=.;UID=sa;PWD=;Database=pubs"

  

    MsgBox  DTSGlobalVariables("adoConnection").Value.Fields.Count

  

    DTSGlobalVariables("adoConnection").Value = nothing

    Main = DTSTaskExecResult_Success

  

End Function

  

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.