Page

14.4.0- Summary

  by NT Community Manager.
Last Updated  by Jim Minatel.  

PublicCategorized as 14. Advanced Data Handling Techniques.

Not tagged.
<< 14.3.3- The Stream ObjectChapter14

Summary

This chapter ends our whirlwind three-chapter tour of ADO. Having already established a foundation in using the Connection and Recordset objects, and in requesting data from databases, this chapter broadened our ADO horizons by looking at the remaining major objects in ADO:

 

  • The Command object, which allows us to run SQL statements against a database
  • The Record object, which allows us to represent non-database structures, as having records and fields
  • The Stream object, which is used to represent binary data or plain text, held in a record

In addition to talking about these three objects, we introduced the notion of writing a SQL command that tells ADO exactly what we want from the data store. We identified two important types of SQL command:

 

  • A SQL SELECT command can be used to request data from the data store. It gives us flexibility over what data we request because it means that each data query doesn't necessarily have to ask for an entire table – instead, we can be choosy over which fields and records we want to see.
  • The SQL UPDATE, INSERT and DELETE commands are collectively known as action commands. They are different because (unlike SELECT) they are all used in the process of making changes to the database – changing records, adding new records and deleting records.

 

We looked at how we can use ASP logic to generate our SQL commands dynamically – allowing the user to choose and dictate, at runtime, the records and fields to be selected, amended, inserted or deleted. Using a SQL command is as simple as specifying the command string as a parameter of the Recordset object's Open method, or the Connection object's Execute method; or by assigning the command string to the Command object's CommandText property and then running the Command.Execute method.

 

We saw that there are also two very direct ways to execute commands on the database:

 

  • Methods of the Recordset object, such as AddNew, Delete, Update and UpdateBatch
  • Calling an Access query or a stored procedure – a precompiled command that is written and contained within the database (in this case, we can extend the capability by the use of parameters in our precompiled queries and stored procedures, which requires the use of the Parameters collection of the Command object)

 

Lastly, we touched briefly on the subject of manipulating data contained in sources other than databases. To do this we introduced the two new objects of ADO 2.5 – the Record and Stream objects. They allow you to manipulate the records and the contents of records. We ran through a few quick examples of how they might be put to use on some simple web administration tasks.

 

We'll be using ADO for our data access in the remaining chapters of this book. In the next chapter, we'll be showcasing ASP and ADO functionality in one big example – the Wrox Classifieds ASP application. Over the course of the chapter, we will see what it does, how to build it, and how it all works.


<< 14.3.3- The Stream ObjectChapter14

Copyright © 2003 by Wiley Publishing, Inc.

Powered by Near-TimeTerms of Services | Privacy Policy | Security Policy |