Server.CreateObject vs CreateObjectBy Ryan S.
If you have ever read a tutorial on component building, you will have undoubtbly seen a few ways to invoke the component. These two ways are Server.CreateObject and CreateObject. But more than likely you probably wonder what is up with that, is there really a difference. Actually, there is.
Server.CreateObject invokes Microsoft Transaction Server (MTS) to create the object and handle it, whereas CreateObject goes straight to it.
While I have found no articles written on these two, the conclusion comes from the fact that if you have an erroneous object, CreateObject gives you an error, but when you do Server.CreateObject, it gives you an error and logs an error in the event log, viewable via Event Viewer.
This can become significant if you are writing a component that deals with transactions, as it would be a good safety net to pass it through MTS, because you will be using MTS commands. However, if you are not using MTS, you could create processor and memory over head by passing it through Server.CreateObject. This makes it a better idea to use CreateObject, because it goes straight through.
I hope you understand the difference now, and when to use the two.
God Bless from Ryan S
This article was written by
Ryan has been a computer programmer
in the loosest sense since the age of 8. He has been working with ASP
since the age of 13, when it first came out (that he knows of), and is
somewhat advanced at it.