When you think ASP, think...
Recent Articles
All Articles
ASP.NET Articles
Message Board
Related Web Technologies
User Tips!
Coding Tips

Sample Chapters
Commonly Asked Message Board Questions
JavaScript Tutorials
MSDN Communities Hub
Official Docs
Stump the SQL Guru!
XML Info
Author an Article
ASP ASP.NET ASP FAQs Message Board Feedback
Print this page.
Published: Thursday, October 15, 1998

Using Visual InterDev 6.0's DTCs

I have recently been using VisualInterDev 6.0's DTC controls quite heavily for someweb development I have been undertaking for a company. These DTCs have somewhat of a steaplearning curve, but once you get the basic handle of these nifty little tools, you will beoff creating visually appealing, ultra-dynamic web sites. There are some drawbacks as wel l,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 toVI 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 an

- continued -

d the developer, making complex, dynamicwebsites easy to implement. The code for a DTC is not pretty, hut it is hidden behind anice looking GUI interface. You may have used the Form Control Wizard in VI 1.0; this is anexample of a DTC.

Visual InterDev 6.0 provides a series of DTCs, such as a Recordset DTC, a FormManager DTC, aPageObject DTC, and data bound form element DTCs. I will discuss the Recordset DTC anddata bound form element DTCs briefly here. A more in depth coverage of these tools can bef ound 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 documentsomewhere, and then choose properties. Once you choose this , check the checkbox, "Enable ScriptingObject 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 everytimeyou've written statement s like these:

Dim rs, Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Session("Conn_ConnectionString")

Set rs = Conn.Execute("SELECT * FROM pubs")

you'd be well off indeed. The Recordset DTC basically does this for you, except a little morein-depth. When you create a Recordset DTC, you first name it, and set if you want to run aspecific 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 recordsetand 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. Sayyou nam e your recordset DTC rstMain. You could then do the following:


I k now this may seem like a silly example, but I just am wanting to show you that the DTC doesexpose the recordset object to the rest of your ASP page. The real neat part of the RecordsetDTC comes once you bind form elements to the DTC.

T he Bound TextBox DTC:
Once you have a recordset DTC running on your page, you can create data bound form elementcontrols, such as textboxes, list boxes, labels, and grids. These can add a lot of power toyour site, and are quite easy to impl ement. I will discuss the implementation of a textboxDTC.

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 fewmore properties you can set, such as what Recordset it's bound too. Select the recordsetDTC 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 arevery quick and easy to use (once you get past the inital learning curve). A person who hashad experience with DTCs, could implement the recordset DTC and text box DTC I just describedabove 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 DTCshave their advantages, they do have their disadvantages as well. Next, I will look at cons ofDTCs.

Cons of DTCs:
DTCs, while fast to make, can be a maintenance headache. As long as a developer famili ar withDTCs who is using VisualInterDev 6.0 is working on the web page, the DTCs won't be toodifficult to maintain, but if your developer lacks the expertise or the tools, maintenance isnext to impossible. As I mentioned earlier, the raw ASP is really th ere, 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 continueto see the pretty GUI interface, b ut try using notepad (or pico or vi for real programmers, and the code is far from maintainable.

I am unaware if DTCs cut into the p erformance of your application as much as writing outthe raw ASP yourself. I assume they must, since if you wrote your own ASP code, you couldcode in your own efficiencies, although I am not certain of this.

I n this article I explored Visual InterDev 6.0's DTCs. We looked at the Recordset DTC as wellas the data bound text box DTC. I also discussed the pros and cons of using DTCs. I wouldhighly recommend experimenting with VI's DTCs to see if they fit your n eed. Like I have beensaying all along, they can be used to create incredibly nice looking sites with very littleupfront time. Happy Programming!

ASP.NET [1.x] [2.0] | ASPMessageboard.com | ASPFAQs.com | Advertise | Feedback | Author an Article