Visual Basic 6 Black Book:Databases: Using DAO, RDO, And ADO
function GetCookie (name)
{
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen)
{
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
var end = document.cookie.indexOf (";", j);
if (end == -1)
end = document.cookie.length;
return unescape(document.cookie.substring(j, end));
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
var m1='';
var gifstr=GetCookie("UsrType");
if((gifstr!=0 ) && (gifstr!=null)) { m2=gifstr; }
document.write(m1+m2+m3);
Keyword
Title
Author
ISBN
Publisher
Imprint
Brief
Full
Advanced Search
Search Tips
Please Select
-----------
Components
Content Mgt
Certification
Databases
Enterprise Mgt
Fun/Games
Groupware
Hardware
IBM Redbooks
Intranet Dev
Middleware
Multimedia
Networks
OS
Prod Apps
Programming
Security
UI
Web Services
Webmaster
Y2K
-----------
New Titles
-----------
Free Archive
To access the contents, click the chapter and section titles.
Visual Basic 6 Black Book
(Publisher: The Coriolis Group)
Author(s): Steven Holzner
ISBN: 1576102831
Publication Date: 08/01/98
function isIE4()
{
return( navigator.appName.indexOf("Microsoft") != -1 && (navigator.appVersion.charAt(0)=='4') );
}
function bookMarkit()
{
var url="http://www.itknowledge.com/PSUser/EWBookMarks.html?url="+window.location+"&isbn=0";
parent.location.href=url;
//var win = window.open(url,"myitk");
//if(!isIE4())
// win.focus();
}
Search this book:
Previous
Table of Contents
Next
Chapter 24Databases: Using DAO, RDO, And ADO
If you need an immediate solution to:
Creating And Managing Databases With The Visual Data Manager
Creating A Table With The Visual Data Manager
Creating A Field With The Visual Data Manager
Entering Data In A Database With The Visual Data Manager
Adding A Data Control To A Program
Opening A Database With The Data Control
Connecting A Data Control To A Bound Control
Registering An ODBC Source
Opening A Database With A Remote Data Control
Connecting A Remote Data Control To A Bound Control
Opening A Database With An ADO Data Control
Connecting An ADO Data Control To A Bound Control
The Data Form Wizard: Creating A Data Form
Using Database Control Methods: Adding, Deleting, And Modifying Records
Adding Records To Databases
Deleting Records In Databases
Refreshing A Data Control
Updating A Database With Changes
Moving To The Next Record
Moving To The Previous Record
Moving To The First Record
Moving To The Last Record
The Data-Bound Controls: From Text Boxes To Flex Grids
The ADO Data-Bound Controls
In Depth
This is our first chapter on databases. In this chapter, were going to see what databases are, exploring the difference between the Microsoft database programming object sets: Data Access Objects (DAO), Remote Data Objects (RDO), and ActiveX Data Objects (ADO).
You may wonder why there are three different sets of database objects in Visual Basic. As it turns out, the reason is historical. At first, Visual Basic only supported DAO, which connected to the Microsoft Jet database engine (the database engine in Microsoft Access). Then, recognizing that there are other database types available, Microsoft created the open database connectivity (ODBC) standard and supported ODBC with Remote Data Objects in Visual Basic. Finally, Microsoft saw that the Web was available too and created Active Data Objects, which make up a flexible standard that allows connections on the same computer, over networks, and through the Web, and is intended to supercede ODBC. ADO is also called OLE DB, and in fact, its based on COM programming techniques (which well see a lot more of in Chapter 26). Well see how to work with all three of these object sets in this and the next chapter.
There are two ways to work with the DAO, RDO, and ADO object sets in Visual Basic. The first way is working with the special controls that support them: the data control (supports DAO), the remote data control (supports ODBC), and the ADO data control (supports ADO). You use those controls to connect to and move through databases, but they dont actually display datayou bind them to other Visual Basic controls, and those bound controls handle the display. The second way is working with the three database object sets directly in code, without controls like the data control or the ADO data control, and thats what well do in the next chapter.
In this chapter, then, well see what databases are all about and how to create and edit them with the Visual Basic Visual Data Manager tool. Next, well examine the data control, the remote data control, and the ADO data control to see how to connect to databases, and well use the bound controls to handle those databases in depth. In the next chapter, well see how to access the data object libraries directly and put them to work in code for additional power.
What Are Databases?
Well begin our discussion of databases by asking just what they are. Like many other programming concepts, databases have become more complex over the years, but the fundamental concept is still a simple one. Say you were in charge of teaching a class and were supposed to hand a grade in for each student. You might make up a table much like the one in Figure 24.1 to record the grade for each student.
Figure 24.1 A table of data.
In fact, youve already created a databaseor more specifically, a database table. The transition from a table on paper to one in a computer is natural: with a computer, you can sort, index, update, and organize large tables of data in an easy way (and without a great waste of paper). You can even connect tables together, creating relational databases.
Each individual data entry in a table, such as a students name, goes into a field in the table. A collection of fields together, such as the Name and Grade fields in our table, make up a record. Each record gets its own row in a table, and each column in that row represents a different field.
A collection of recordsthat is, rows of records where each column is a fieldbecomes a table. What, then, is a database? A database is just a collection of one or more tables. In fact, you can go farther than that in Visual Basicyou can have collections of databases. In DAO, those collections are called the workspace, and in RDO and ADO, they are referred to as the data environment. You can also have indices in databases, and those are pointers to specific fields, either in the current database or another one.
Now that youve set up a database, how do you work with the data in that database? One popular way is to use Structured Query Language (SQL), which well see more about in the next chapter. You use SQL to set up a query, which when applied to a database gives you a record set. This record set is made up of the records from the database that matched your queryfor example, you may have asked for all students that got a grade of B or better. Well see more about working with databases in code like this in the next chapter.
Previous
Table of Contents
Next
Products | Contact Us | About Us | Privacy | Ad Info | Home
Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.
Wyszukiwarka
Podobne podstrony:
821 8242 Systemsid 821819 821821 (2)news 821824 827824 826więcej podobnych podstron