use a variable to build "Server.CreateObject"

Results 1 to 4 of 4

Thread: use a variable to build "Server.CreateObject"

  1. #1
    powertie Guest

    Default use a variable to build "Server.CreateObject"

    Does anyone know if it is possible to use a variable to build a Server.CreateObject statement? Here&#039;s what I mean...<BR><BR>I know I can use a case select statement like this:<BR>select case var<BR>case 1<BR>set objOBJ = Server.CreateObject("ADODB.Command")<BR>case 2<BR>set objOBJ = Server.CreateObject("ADODB.Recordset")<BR>end select<BR><BR>But I would like to do something like this:<BR>var = "ADODB.Command"<BR>set objOBJ = Server.CreateObject("var")<BR><BR>Please help! Thanks.

  2. #2
    Join Date
    Dec 1969

    Default RE: use a variable to build

    I&#039;d imagine you could do var without the quotes, but why would you need to do this? Some sorta global function that creates and returns objects?<BR><BR>Set obj = Server.CreateObject(var)

  3. #3
    Join Date
    Dec 1969

    Default you almost did it..

    var = "ADODB.Command"<BR>set objOBJ = Server.CreateObject(var)<BR><BR>

  4. #4
    powertie Guest

    Default THANKS!!

    Thanks to all. It worked. I work with WSCs and now I can use a database to dynamically generate WSCs on the fly.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts