In this chapter we saw how we can put our knowledge of ADO, MTS, ActiveX servers and XML together to create one powerful tool. Using this recipe, we can create more scalable applications that use just such an ADO data layer and take advantage of the latest technological breakthroughs like MTS and XML. All of our company's projects use a form of this data layer since it offers so many advantages including scalability and encapsulation.
Where might we go from here to improve this data layer? A good start would be to include support for stored procedure execution. Stored procedures are a vital aspect of most enterprise applications and we could easily incorporate them into this data layer concept. All we would have to do is to create a method called ExecuteProc, for example, which accepts the stored procedure's name and a set of parameters to execute it with. It would end up being very similar to the ExecuteSQL method except that we would use ADO code to pass in the parameters to the stored procedure, most likely using the ADODB.Command object. But I'll leave that to you as this is only the beginning of what a data layer can do for you. Another idea that we could use the data layer for that is already built into the code in this chapter is to execute an action query. So as you can see, this short bit of code packs a powerful punch.
As we've demonstrated, the data layer implemented in this chapter is written to run under COM+'s MTS. Keep in mind that MTS components are written to be stateless. In other words, we cannot call an object, have it remember information via properties (for example) and then expect to call it later and have that information still exist. This would mean that the object instance would have to live at least from the time you set those properties and then call it again at a later time to check those properties. This is known as retaining state and violates the n-tiered architecture's stateless model.
This chapter is the transition between the ADO topics and the RDS topics. I thought it was a good place to put it as we just finished going over ADO's features and now we are about to tackle RDS, which can invoke ActiveX server remotely from a browser client. RDS is a great technology that allows us to accomplish tasks that were previously impossible. For example, we can create instances of ActiveX server on a web server from a client Internet Explorer browser! We'll see this and more in the next chapter when go enter Chapter 13, The RDS Objects.