![]() |
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() |
![]() |
To access the contents, click the chapter and section titles.
Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6!
Should Visual Basic Be Your Database Development Tool?Before moving to the main subject of how to use Visual Basic to create relational database frontend applications, an important question must be addressed: Should you use Visual Basic at all? I know this may sound like heresy coming from an avowed Visual Basic fan, but I would be remiss in my duties if I skipped this issue. The simple fact is that Visual Basic is not the preferred choice in all circumstances. This statement is not a slur on Visual Basicno other tool brings such a combination of ease of use and power to database developmentbut to expect any one tool, no matter how terrific, to be the best choice for all jobs is unrealistic. This section briefly looks at some of the factors to consider when deciding whether to use Visual Basic. Programmer, Know ThyselfOne of the most important factors when deciding on a databasedevelopment tool is to assess your own experience and knowledge. Obviously, you are interested in Visual Basic or you wouldnt be reading this book. But are you a complete novice at Basic, or do you have many years of Basic programming experience (with, for example, Quick Basic) and are new only to the Visual part? Perhaps you are an expert in xBase programming (the language used by the dBase family of database products and several clones, such as FoxPro) and are investigating Visual Basic as an alternate tool. If you currently have a programming project that is a rush job, with strict deadlines, you may be wise to go with the development tool that you know best and leave Visual Basic on the shelf until next time. If your timetable is more relaxed, however, that project may be a good opportunity to hone your Visual Basic skills while working on a realworld project. Is It A Legacy Database?If you are being asked to write new frontend applications for an existing, or legacy, database, the nature of the existing database may place restrictions on your choice of development tools. Clearly, the existing data has to be retained, so the new application must be able to access it. Many old database systems run on mainframes or minicomputers and use obscure or antiquated database file formats. If you are completely revamping the entire system, you may be able to convert existing data files to a different format. If parts of the existing system will remain in use, you cant modify the data file format. Instead, you have to select a development tool that supports that format. The next chapter provides information about the database formats supported by Visual Basic. The Visual Basic Fan ClubAs you can see, a few issues might steer you away from using Visual Basic for a specific databaseapplication development project. In the absence of such particular issues, however, the selection of a development tool is still an important decision. I cant claim to be completely objective, primarily because I have more extensive knowledge of Visual Basic than any other database development tool. That aside, here are some of the reasons why I think that Visual Basic leads the pack in Windows database development:
For More InformationVisual Basic database programming is a large and complex subject. The next few chapters provide a good start, but not much more. When youre finished with this book, you should have a firm grasp of the techniques needed to create a singleuser, relationaldatabase front end for both a decisionsupport application and a transactionprocessing application. Using Visual Basic for professional database development, however, requires some real, indepth understanding. Several books cover Visual Basic database programming exclusively, going into much more detail than I can here. If you finish this book and discover that your Visual Basic database programming needs are more demanding, I suggest that you read one of the morespecialized Visual Basic programming books. The next section covers the database development tools that Visual Basic provides. As the previous chapter discusses, Visual Basic offers several different database technologies. The discussion in this chapter is limited to ActiveX Data Objects, or ADO, the newest and most powerful database tool in the Visual Basic arsenal. The Data Object ModelMicrosoft and Visual Basic approach databases based on something I callfor lack of an official namethe data object model. Why that name? Because, to a large extent, all the components that make up a database are objects. And what is an object? Its a type of software component, just like the software components that you use daily in Visual Basic. Objects contain variables (properties) and subprograms (methods), and data objects sometimes contain members that are also objects. At times, objects are referred to as interfaces, because the objects properties and methods provide an interface between the outside world (the program that is using the object) and its inner workings. The ADO model is the specific data object model addressed here. This model contains the following seven objects:
The objects in the ADO model are organized as follows, and as diagrammed in Figure 21.2:
In broad outline, a typical ADO session proceeds as follows:
|
![]() |
Pr |