Using Visual InterDev 6.0's DTCs
Introduction: I have recently been using VisualInterDev 6.0's DTC controls quite heavily for some web development I have been undertaking for a company. These DTCs have somewhat of a steap learning curve, but once you get the basic handle of these nifty little tools, you will be off creating visually appealing, ultra-dynamic web sites. There are some drawbacks as well, which I intend to discuss in this article, along with a basic explanation of these controls. If you would like a tutorial on how to develop web applications using VI 6.0 as opposed to VI 1.0, please check out my website, http://www.4GuysFromRolla.com/webtech.
I have recently been using VisualInterDev 6.0's DTC controls quite heavily for some web development I have been undertaking for a company. These DTCs have somewhat of a steap learning curve, but once you get the basic handle of these nifty little tools, you will be off creating visually appealing, ultra-dynamic web sites. There are some drawbacks as well, which I intend to discuss in this article, along with a basic explanation of these controls. If you would like a tutorial on how to develop web applications using VI 6.0 as opposed to VI 1.0, please check out my website, http://www.4GuysFromRolla.com/webtech.
So what is a DTC?
A DTC, or Design Time Control, is a GUI tool used to enhance the development of your website. It provides a layer of abstraction between the code and the developer, making complex, dynamic websites easy to implement. The code for a DTC is not pretty, hut it is hidden behind a nice looking GUI interface. You may have used the Form Control Wizard in VI 1.0; this is an example of a DTC.
Visual InterDev 6.0 provides a series of DTCs, such as a Recordset DTC, a FormManager DTC, a PageObject DTC, and data bound form element DTCs. I will discuss the Recordset DTC and data bound form element DTCs briefly here. A more in depth coverage of these tools can be found at Microsoft's Visual InterDev 6.0 Site.
To use the DTC's on your ASP page, you will need to right click in the body of your HTML document somewhere, and then choose properties. Once you choose this, check the checkbox, "Enable Scripting Object Model." Now you can use the DTCs.
The Recordset DTC:
If you are an Active Server Pages Programmer, and if you somehow were given a nickel for everytime you've written statements like these:
Dim rs, Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Set rs = Conn.Execute("SELECT * FROM pubs")
you'd be well off indeed. The Recordset DTC basically does this for you, except a little more in-depth. When you create a Recordset DTC, you first name it, and set if you want to run a specific SQL Query, a view, a stored procedure, or just return the results from a table. You can also set the cursor type, connection timeout, command timeout, and other recordset and connection and command properties that are available in ADO.
Once you have this Recordset DTC you can refer to it in server side code very simply. Say
you name your recordset DTC rstMain. You could then do the following:
I know this may seem like a silly example, but I just am wanting to show you that the DTC does expose the recordset object to the rest of your ASP page. The real neat part of the Recordset DTC comes once you bind form elements to the DTC.
The Bound TextBox DTC:
Once you have a recordset DTC running on your page, you can create data bound form element controls, such as textboxes, list boxes, labels, and grids. These can add a lot of power to your site, and are quite easy to implement. I will discuss the implementation of a textbox DTC.
Once you create a textbox DTC, edit it's properties. The editable properties are the name, its size, if its a textbox or a textarea, and the maximum length allowed in the textbox. This is all fun and good, but we've yet to get to the meat 'n' potatos. There are a few more properties you can set, such as what Recordset it's bound too. Select the recordset DTC name you just created. You can then select what column you want the textbox bound to, and that's it! You will have just had created a data bound text box DTC.
As you can probably tell by now, DTCs add a visually appealing interface to your site, and are very quick and easy to use (once you get past the inital learning curve). A person who has had experience with DTCs, could implement the recordset DTC and text box DTC I just described above in a matter of seconds. This would take much longer to write out the raw ASP code (although I'll argue that writing the raw ASP is a lot more fulfilling and fun). While DTCs have their advantages, they do have their disadvantages as well. Next, I will look at cons of DTCs.
Cons of DTCs:
DTCs, while fast to make, can be a maintenance headache. As long as a developer familiar with DTCs who is using VisualInterDev 6.0 is working on the web page, the DTCs won't be too difficult to maintain, but if your developer lacks the expertise or the tools, maintenance is next to impossible. As I mentioned earlier, the raw ASP is really there, just behind the scenes. Let me tell you, though, that the raw ASP is very ugly. It is complicated code, and it would be naive to expect it to be very readable. If you keep using VI, you will continue to see the pretty GUI interface, but try using notepad (or pico or vi for real programmers (interested in what makes someone a real programmer?), and the code is far from maintainable.
I am unaware if DTCs cut into the performance of your application as much as writing out the raw ASP yourself. I assume they must, since if you wrote your own ASP code, you could code in your own efficiencies, although I am not certain of this.
In this article I explored Visual InterDev 6.0's DTCs. We looked at the Recordset DTC as well as the data bound text box DTC. I also discussed the pros and cons of using DTCs. I would highly recommend experimenting with VI's DTCs to see if they fit your need. Like I have been saying all along, they can be used to create incredibly nice looking sites with very little upfront time. Happy Programming!
IT Solutions Builder TOP IT RESOURCES TO MOVE YOUR BUSINESS FORWARD
Which topic are you interested in?
What is your company size?
What is your job title?
What is your job function?
Searching our resource database to find your matches...