| ADO.NET Programming in Visual Basic .NET |
By Steve Holzner, Bob Howell
|Table of Contents|
In this chapter, we will create our own .NET version of the VB 6 ADO Data Control, an exercise designed to demonstrate the robust features of ADO .NET. Up until now, we have investigated the ADO .NET components and we have built simple forms using these components . We have discovered that ADO .NET is a much more robust tool than ADO. We have also discovered that it is inherently more complicated. Creating a simple data form with bound controls now requires a minimum of three ADO .NET Data Components, where ADO only required one.
For those of us used to the RAD tools of VB 6, VB .NET seems a bit daunting. I was never a big proponent of using data-bound controls in previous versions of VB because, while you could create a working application faster using data-bound controls, you also relinquished a lot of control over what was happening in the background. I admit that as a programmer, I am a control freak. I like to control what goes on behind the scenes. I have, however, used the old data control in a few circumstances. One good use was as a navigation control. It made a good visual control for navigating a table or RecordSet. This was especially true when used in conjunction with the ADO DataGrid control. Another good use was when I needed to create a simple stand-alone form for quick data entry, and I didn't have time to fool with too much code.
I never used it in enterprise class applications for widespread distribution though, except as a navigation control. And that leads me to ask this question: Why did Microsoft choose to omit a navigation control from the Windows Forms classes? Was it to keep the "script kiddies" away? Who knows ? Anyway, Microsoft's omission is our opportunity. By creating our own control, we will put to use many of the components and techniques of ADO .NET.
My only reservation is that you will create this control, and then use it in your production applications. While I have no problem with this from the standpoint of ethics, I do want to make this disclaimer: This control is for instructional purposes only. Any use beyond this is at your peril. I have debugged the code sufficiently for instructional use, but I have not performed a full battery of tests on it. If you use the control, you will be responsible for making sure that it is tested and ready to use in a production environment.