ActiveX VBScript problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pippen

    ActiveX VBScript problem

    Below is a code snippet that is throwing the following error:

    Error Source: Microsoft DTS Package

    Error Description: Error Code: 0
    Error Source= Microsoft VBScript runtime error
    Error Description: Object required: 'Server'

    Error on line 13

    In my code line 13 is the following:
    Set Cnxn = Server.CreateOb ject("ADODB.con nection")

    I did set up a Microsoft OLE DB connection in my DTS package for this
    ActiveX Task. I'm new to VBScript and ActiveX. Any help would be
    appreciated.

    Thanks,

    -p

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

    Function Main()
    Main = DTSTaskExecResu lt_Success

    ' connection, command and recordset variables
    Dim Cnxn, strCnxn

    ' create and open connection
    Set Cnxn = Server.CreateOb ject("ADODB.con nection")
    strCnxn = "data source=Pluto;in itial catalog=Stats;U ser Id=sa;password= ;"
    Cnxn.Open strCnxn

    End Function



  • Dan Guzman

    #2
    Re: ActiveX VBScript problem

    The Server object is only available when running scripts under IIS. You
    don't need it when running scripts via DTS or stand-alone. Try:

    Set Cnxn = CreateObject("A DODB.Connection ")

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    "Pippen" <123@hotmail.co m> wrote in message
    news:ESCWc.2230 77$eM2.87297@at tbi_s51...[color=blue]
    > Below is a code snippet that is throwing the following error:
    >
    > Error Source: Microsoft DTS Package
    >
    > Error Description: Error Code: 0
    > Error Source= Microsoft VBScript runtime error
    > Error Description: Object required: 'Server'
    >
    > Error on line 13
    >
    > In my code line 13 is the following:
    > Set Cnxn = Server.CreateOb ject("ADODB.con nection")
    >
    > I did set up a Microsoft OLE DB connection in my DTS package for this
    > ActiveX Task. I'm new to VBScript and ActiveX. Any help would be
    > appreciated.
    >
    > Thanks,
    >
    > -p
    >
    > '************** *************** *************** *************** ***********
    > ' Visual Basic ActiveX Script
    > '************** *************** *************** *************** *************
    >
    > Function Main()
    > Main = DTSTaskExecResu lt_Success
    >
    > ' connection, command and recordset variables
    > Dim Cnxn, strCnxn
    >
    > ' create and open connection
    > Set Cnxn = Server.CreateOb ject("ADODB.con nection")
    > strCnxn = "data source=Pluto;in itial catalog=Stats;U ser Id=sa;password= ;"
    > Cnxn.Open strCnxn
    >
    > End Function
    >
    >
    >[/color]


    Comment

    • Pippen

      #3
      Re: ActiveX VBScript problem


      "Dan Guzman" <guzmanda@nospa m-online.sbcgloba l.net> wrote in message
      news:NNGWc.4935 $N04.1043@newss vr23.news.prodi gy.com...[color=blue]
      > The Server object is only available when running scripts under IIS. You
      > don't need it when running scripts via DTS or stand-alone. Try:
      >
      > Set Cnxn = CreateObject("A DODB.Connection ")
      >
      > --
      > Hope this helps.
      >
      > Dan Guzman
      > SQL Server MVP
      >
      > "Pippen" <123@hotmail.co m> wrote in message
      > news:ESCWc.2230 77$eM2.87297@at tbi_s51...[color=green]
      > > Below is a code snippet that is throwing the following error:
      > >
      > > Error Source: Microsoft DTS Package
      > >
      > > Error Description: Error Code: 0
      > > Error Source= Microsoft VBScript runtime error
      > > Error Description: Object required: 'Server'
      > >
      > > Error on line 13
      > >
      > > In my code line 13 is the following:
      > > Set Cnxn = Server.CreateOb ject("ADODB.con nection")
      > >
      > > I did set up a Microsoft OLE DB connection in my DTS package for this
      > > ActiveX Task. I'm new to VBScript and ActiveX. Any help would be
      > > appreciated.
      > >
      > > Thanks,
      > >
      > > -p
      > >
      > > '************** *************** *************** *************** ***********
      > > ' Visual Basic ActiveX Script
      > >[/color][/color]
      '************** *************** *************** *************** *************[color=blue][color=green]
      > >
      > > Function Main()
      > > Main = DTSTaskExecResu lt_Success
      > >
      > > ' connection, command and recordset variables
      > > Dim Cnxn, strCnxn
      > >
      > > ' create and open connection
      > > Set Cnxn = Server.CreateOb ject("ADODB.con nection")
      > > strCnxn = "data source=Pluto;in itial catalog=Stats;U ser[/color][/color]
      Id=sa;password= ;"[color=blue][color=green]
      > > Cnxn.Open strCnxn
      > >
      > > End Function
      > >
      > >
      > >[/color]
      >
      >[/color]

      That fixed it! Thanks for your help.

      -p


      Comment

      Working...