Summary

Chapter 3 - Connecting to a Data Source
byJohn Kauffman, Fabio Claudio Ferracchiatiet al.?
Wrox Press ?2002

All operations that involve data on an ASP.NET page start with a connection to the data source. Making a connection requires you to specify the data source itself, how to translate the data from that source into the ADO.NET objects you're going to use, and any necessary security information.

ADO.NET provides four different kinds of connection. The first uses the SQL Server .NET data provider, which contains a specialized set of code for connecting to Microsoft SQL Server (version 7 or higher). If you're using SQL Server as your data source, this should be your first choice.

The second type of connection, OLE DB, is very general, and allows us to connect to a wide variety of data sources - in this chapter alone, we've used it to connect to Access and Excel. We've also seen how to create a connection simply by specifying a provider that's appropriate for our data source. Remember, though, that an OLE DB connection pays a performance price in order to maintain capability with a broad range of data sources. For that reason, you should only use an OLE DB connection if there's no specialized connection available.

The third type of connection is for ODBC databases, and is not covered in this book. However, the ODBC .NET data provider supplies broadly the same functionality as the OLE DB version.

The fourth kind of 'connection' provides access to XML files or streams. This is not a true connection in the sense of the others we've looked at - there's no connection object - but the ability exists to generate a data stream that can be used by the ADO.NET objects.

In this chapter, then, we've talked in depth about how to connect to various data stores. In the next two chapters, we'll examine two ways to bring data through the connection that we've touched upon already: the data reader and dataset objects. At the same time, we'll look at some more ways to display data to your users.



Beginning ASP. NET 2.0 and Databases
Beginning ASP.NET 2.0 and Databases (Wrox Beginning Guides)
ISBN: 0471781347
EAN: 2147483647
Year: 2004
Pages: 263

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