本文档由李欣蔚(nirvana_li)翻译自http://www.csharp-station.com/,转载请注名出处! 更新日期2006-2-14
Lesson 01: Introduction to ADO.NET
This lesson is an introduction to ADO.NET. It introduces primary ADO.NET concepts and objects that you will learn about in later lessons. Here are the objectives of this lesson:
- 了解什么是ADO.NET
- 理解什么是data provider
- 理解什么是connection对象
- 理解什么是command对象
- 理解什么是DataReader对象
- 理解什么是DataSet对象
- 理解什么是DataAdapter对象
Introduction
ADO.NET is an object-oriented set of libraries that allows you to interact with data sources. Commonly, the data source is a data base, but it could also be a text file, an Excel spread sheet, or an XML file. For the purposes of this tutorial, we will look at ADO.NET as a way to interact with a data base.
ADO.NET是一组用于和数据源进行交互的面向对象类库。通常情况下,数据源是数据库,但它同样也能够是文本文件、Excel表格或者XML文件。因为本指南的需要,我们将ADO.NET当作是一种于数据库的交互方式。
As you are probably aware, there are many different types of data bases available. For example, there is Microsoft SQL Server, Microsoft Access, Oracle, Borland Interbase, and IBM DB2, just to name a few. To further refine the scope of this tutorial, all of the examples will use SQL Server.
你可能已经注意到有许多不同类型的数据库可供使用。比如:Microsoft SQL Server, Microsoft Access, Oracle, Borland Interbase和IBM DB2等。本指南的所有例子都将使用SQL Server。
You can download the Microsoft SQL Server 2000 Desktop Engine (MSDE 2000) here:
从这里可以下载得到Microsoft SQL Server 2000 Desktop Engine (MSDE 2000):
http://www.microsoft.com/sql/msde/downloads/download.asp
MSDE contains documentation on how to perform an installation. However, for your convenience, here are quick instructions on how to install MSDE:
MSDE包含了指导如何安装的文档。然而,为了更加方便,下面是如何安装MSDE的快速说明:
http://www.asp.net/msde/default.aspx?tabindex=0&tabid=1
MSDE 2000 is a scaled down version of SQL Server. Therefore, everything you learn in this tutorial and all code will work with SQL Server. The examples will use the Northwind database. This is a tutorial is specifically for ADO.NET. MSDE is not part of ADO.NET, but it is one of the many data sources you can interact with by using ADO.NET If you need help with MSDE 2000, I refer you to the Microsoft Web site, where you can find pertinent information on licensing and technical assistance:
http://www.microsoft.com/sql/msde/
MSDE 2000是SQL Server的缩微版。因此,本指南中所有的内容和代码都是和SQL Sever有关的。实例将会使用Northwind数据库。这是对ADO.NET的特殊化的指南。MSDE并不是ADO.NET的一部分,但却是使用与ADO.NET的数据源中的一种。如果需要MSDE 2000的帮助,可以在Microsoft站点早到合适的关于许可以及技术支持的信息:
Data Providers
数据提供程序
We know that ADO.NET allows us to interact with different types of data sources and different types of data bases. However, there isn''''t a single set of classes that allow you to accomplish this universally. Since different data sources expose different protocols, we need a way to communicate with the right data source using the right protocol. Some older data sources use the ODBC protocol, many newer data sources use the OleDb protocol, and there are more data sources every day that allow you to communicate with them directly through .NET ADO.NET class libraries.
ADO.NET允许和不同类型的数据源以及数据库进行交互。然而并没有与此相关的一系列类来完成这样的工作。因为不同的数据源采用不同的协议,所以对于不同的数据源必须采用相应的协议。一些老式的数据源使用ODBC协议,许多新的数据源使用OleDb协议,并且现在还不断出现更多的数据源,这些数据源都可以通过.NET的ADO.NET类库来进行连接。
ADO.NET provides a relatively common way to interact with data sources, but comes in different sets of libraries for each way you can talk to a data source. These libraries are called Data Providers and are usually named for the protocol or data source type they allow you to interact with. Table 1 lists some well known data providers, the API prefix they use, and the type of data source they allow you to interact with.
ADO.NET提供与数据源进行交互的相关的公共方法,但是对于不同的数据源采用一组不同的类库。这些类库称为Data Providers,并且通常是以与之交互的协议和数据源的类型来命名的。表1列处了一些常见的data providers,以及它们所使用的API前缀,和允许进行交互的数据源类型。
Table 1. ADO.NET Data Providers are class libraries that allow [1] [2] [3] [4] 下一页 [C语言系列]NET 中C#的switch语句的语法 [系统软件]托拽Explore中的文件到VB.net的窗口 [系统软件]Boost库在XP+Visual C++.net中的安装 [常用软件]新配色面板:Paint.Net3.0RC1官方下载 [常用软件]用内建的“Net Meeting”聊天 [VB.NET程序]Henry的VB.NET之旅(三)—共享成员 [VB.NET程序]Henry的VB.NET之旅(二)—构造与析构 [VB.NET程序]Henry的VB.NET之旅(一)—失踪的窗体 [VB.NET程序]在托盘上显示Balloon Tooltip(VB.NET) [VB.NET程序]Henry手记-VB.NET中动态加载Treeview节点(二)
|