Chapter 4: Getting Connected

Team-Fly

Overview

WHEN YOU WANT ADO TO RETRIEVE data, you have to either create the data yourself or somehow connect to a data source and suck the data down. In some cases (as we'll discuss in the "Desperately Seeking Performance" and "Passing Data Between Tiers" sections), you can extract data from nontraditional data sources, such as an ActiveX Server Page (ASP) or an XML data Stream. But if you want to get data out of SQL Server, Access (Jet), Oracle, or any other "traditional" database, you have to use a connection—at least at first. This also holds true for any of the plethora of ODBC and OLE DB data sources available when you install MDAC 2.× (see Figure 4-1). However, you don't necessarily have to formally create your own ADO Connection object—in many cases ADO will create one for you.

click to expand
Figure 4-1: OLE DB Providers

This chapter discusses why, when, and how to use ADO Connection objects to get connected. While these objects won't help your social life, they will help you get in touch with your data. Frankly, based on the number of questions generated in my classes and the length of time the connection labs consume, getting connected (to databases) seems to be quite daunting for some people—and not just for those getting started with ADO. For example, there seems to be quite a bit of confusion regarding the ConnectionString and how to construct it correctly (and efficiently). I'll discuss a few tips and tricks in this regard as we go.


Team-Fly


ADO Examples and Best Practices
Ado Examples and Best Practices
ISBN: 189311516X
EAN: 2147483647
Year: 2000
Pages: 106

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net