Low cost ecommerce web development India flash website design

Instantiating an Object

To create an instance of a COM object in ASP, you can use a statement like

the following:

Set Object = Server.CreateObject("ADODB.Connection")

There is only one argument to the CreateObject method of Server that is the

ProgId (the program ID). The ProgId is assigned by every component

vendor to uniquely identify the COM object. To create an instance of the

COM object, you must know the ProgId of the COM object.

There is another way to get an instance of a COM object. You can have

another COM object create the object and return the newly created object to

you. This is how a collection works. You call the Item method of a

collection, and a COM object is returned that represents the subset of the

collection, which you index. Whenever a COM object is returned by another

object, you must preface the statement with Set.

Set Object = Collection.Item(2)

Because Server is a COM object, both the examples above are much alike.

They both return COM objects with a call to another COM object. The

difference is that the CreateObject method of the Server object can return

any COM object, and the Item method can only return COM objects that are

stored in the collection. If you need to have a COM object to create another

COM object, where did the Server object come from? ASP has a set of builtin

COM objects that solve this chicken-or-the-egg problem.

freelance web designer India web development

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73