SQL Distributed Management Objects

Compiling the project

Compiling the Project

After entering the code in the class module, compile the project to make a DLL. It would be better to reference the "Microsoft Active Server Pages Object Library" in the project so ASP will not give us an "Out of Process Component" error message if we try to call the component from any ASP page. In a nutshell, what this means is that this component will know that it needs to access the Active Server Pages DLL (asp.dll) to run. Finally, compile the project as a DLL. Voila! You have created an ASP component that can add and remove SQL Scheduler tasks.


Consider a scenario in which you create an e-commerce application. You have used SQL Server for data-storage purposes. Users come and register on your site before doing any shopping on your site, and they place orders, but leave your site without checking out.

You should be able to delete the items they placed in their shopping basket. It would be tedious to manually check the database for valid records and delete the unwanted records. Instead, use the component you just created and create a task that would search the database for invalid or unwanted records and would delete them automatically after a certain amount of time.

Similarly, you can create and run a VB application once a month that would remove the accomplished tasks from the SQL Server. Alternately, you could create a component that would check and remove the unwanted tasks from the SQL Server, create a new task manually, and call this component using the extended stored procedures provided with SQL Server to remove the unwanted tasks from the SQL Server. SQL Server 6.5 and later provides the capability of loading and executing COM objects through a set of OLE Automation stored procedures or through extended stored procedures.

You might also like...


About the author

S.S. Ahmed United States

S.S. Ahmed is a senior IT Professional and works for a web and software development firm. Ahmed is a Microsoft Office SharePoint Server MVP. Ahmed specializes in creating database driven dynamic...

Interested in writing for us? Find out more.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Better train people and risk they leave – than do nothing and risk they stay.” - Anonymous