Practical Database Programming With Visual C#.NET- P2

Chia sẻ: Thanh Cong | Ngày: | Loại File: PDF | Số trang:50

0
84
lượt xem
26
download

Practical Database Programming With Visual C#.NET- P2

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Tham khảo tài liệu 'practical database programming with visual c#.net- p2', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả

Chủ đề:
Lưu

Nội dung Text: Practical Database Programming With Visual C#.NET- P2

  1. 2.11 Create Oracle 10g XE Sample Database 73 Figure 2.51 Completed LogIn table. length of the string depends on the number of real letters entered by the user. The data types for all columns are VARCHAR2 with one exception, which is the phone column that has a CHAR type with an upper bound of 12 letters since our phone numbers are composed of 10 digits, and we can extend this length to 12 with two dashes. For all other columns, the length varies with the different information, so the VARCHAR2 is selected for those columns. The finished design view of your Faculty table is shown in Figure 2.52. You need to check the Not Null checkbox for the faculty_id column since we selected this column as the primary key for this table. Click on the Next button to go to the next page to add the primary key for this table, which is shown in Figure 2.53. Check the Not Populated from the primary key list since we don’t want to use any Sequence object to automatically generate a sequence of numeric numbers as our primary key, and then select the FACULTY_ID(VARCHAR2) from the Primary Key textbox. In this way, the faculty_id column is selected as the primary key for this table. Keep the Composite Primary Key box untouched since we do not have that kind of key in this table, and click on the Next button to go to the next page. Since we have not created all other tables to work as our reference tables for the foreign key, click on Next to continue, and we will do the foreign key for this table later. Click on the Finish button to go to the Confirm page. Finally click on the Create button to create this new Faculty table. Your completed columns in the Faculty table are shown in Figure 2.54.
  2. 74 Chapter 2 Introduction to Databases Figure 2.52 Finished design view of the Faculty table. Figure 2.53 Opened Primary Key window.
  3. 2.11 Create Oracle 10g XE Sample Database 75 Figure 2.54 Completed columns in the Faculty table. Table 2.24 Data in the Faculty Table faculty_id faculty_name office phone college title email A52990 Black Anderson MTC-218 750-378-9987 Virginia Tech Professor banderson@college.edu A77587 Debby Angles MTC-320 750-330-2276 University of Chicago Associate Professor dangles@college.edu B66750 Alice Brown MTC-257 750-330-6650 University of Florida Assistant Professor abrown@college.edu B78880 Ying Bai MTC-211 750-378-1148 Florida Atlantic University Associate Professor ybai@college.edu B86590 Satish Bhalla MTC-214 750-378-1061 University of Notre Dame Associate Professor sbhalla@college.edu H99118 Jeff Henry MTC-336 750-330-8650 Ohio State University Associate Professor jhenry@college.edu J33486 Steve Johnson MTC-118 750-330-1116 Harvard University Distinguished Professor sjohnson@college.edu K69880 Jenney King MTC-324 750-378-1230 East Florida University Professor jking@college.edu Now click on the Data object tool to add the data into this new table. Click on the Insert Row button to add all rows that are shown in Table 2.24 into this table. Click on the Create and Create Another button when the first row is done, and con- tinue to create all rows with the data shown in Table 2.24. You may click on the Create button for your last row. Your finished Faculty table should match the one shown in Figure 2.55. 2.11.2.3 Create Other Tables In a similar way, you can continue to create the following three tables: Course, Student, and StudentCourse based on the data shown in Tables 2.25, 2.26, and 2.27.
  4. 76 Chapter 2 Introduction to Databases Figure 2.55 Finished Faculty table. The data types used in the Course table are: • course_id: VARCHAR2(10)—primary Key • course: VARCHAR2(40) • credit: NUMBER(1, 0)—precision = 1, scale = 0 (1-bit integer) • classroom: CHAR(6) • schedule: VARCHAR2(40) • enrollment: NUMBER(2, 0)—precision = 2, scale = 0 (2-bit integer) • faculty_id: VARCHAR2(10) The data types used in the Student table are: • student_id: VARCHAR2(10)—primary Key • student_name: VARCHAR2(20) • gpa: NUMBER(3, 2)—precision = 3, scale = 2 (3-bit floating point data with 2-bit after the decimal point) • credits: NUMBER(3, 0)—precision = 3, scale = 0 (3-bit integer) • major: VARCHAR2(40) • schoolYear: VARCHAR2(20) • email: VARCHAR2(20) The data types used in the StudentCourse table are: • s_course_id: NUMBER(4, 0)—precision = 4, scale = 0 (4-bit integer) primary key • student_id: VARCHAR2(10)
  5. 2.11 Create Oracle 10g XE Sample Database 77 Table 2.25 Data in the Course Table course_id course credit classroom schedule enrollment faculty_id CSC-131A Computers in Society 3 TC-109 M-W-F: 9:00-9:55 AM 28 A52990 CSC-131B Computers in Society 3 TC-114 M-W-F: 9:00-9:55 AM 20 B66750 CSC-131C Computers in Society 3 TC-109 T-H: 11:00-12:25 PM 25 A52990 CSC-131D Computers in Society 3 TC-119 M-W-F: 9:00-9:55 AM 30 B86590 CSC-131E Computers in Society 3 TC-301 M-W-F: 1:00-1:55 PM 25 B66750 CSC-131F Computers in Society 3 TC-109 T-H: 1:00-2:25 PM 32 A52990 CSC-132A Introduction to Programming 3 TC-303 M-W-F: 9:00-9:55 AM 21 J33486 CSC-132B Introduction to Programming 3 TC-302 T-H: 1:00-2:25 PM 21 B78880 CSC-230 Algorithms & Structures 3 TC-301 M-W-F: 1:00-1:55 PM 20 A77587 CSC-232A Programming I 3 TC-305 T-H: 11:00-12:25 PM 28 B66750 CSC-232B Programming I 3 TC-303 T-H: 11:00-12:25 PM 17 A77587 CSC-233A Introduction to Algorithms 3 TC-302 M-W-F: 9:00-9:55 AM 18 H99118 CSC-233B Introduction to Algorithms 3 TC-302 M-W-F: 11:00-11:55 AM 19 K69880 CSC-234A Data Structure & Algorithms 3 TC-302 M-W-F: 9:00-9:55 AM 25 B78880 CSC-234B Data Structure & Algorithms 3 TC-114 T-H: 11:00-12:25 PM 15 J33486 CSC-242 Programming II 3 TC-303 T-H: 1:00-2:25 PM 18 A52990 CSC-320 Object Oriented Programming 3 TC-301 T-H: 1:00-2:25 PM 22 B66750 CSC-331 Applications Programming 3 TC-109 T-H: 11:00-12:25 PM 28 H99118 CSC-333A Computer Arch & Algorithms 3 TC-301 M-W-F: 10:00-10:55 AM 22 A77587 CSC-333B Computer Arch & Algorithms 3 TC-302 T-H: 11:00-12:25 PM 15 A77587 CSC-335 Internet Programming 3 TC-303 M-W-F: 1:00-1:55 PM 25 B66750 CSC-432 Discrete Algorithms 3 TC-206 T-H: 11:00-12:25 PM 20 B86590 CSC-439 Database Systems 3 TC-206 M-W-F: 1:00-1:55 PM 18 B86590 CSE-138A Introduction to CSE 3 TC-301 T-H: 1:00-2:25 PM 15 A52990 CSE-138B Introduction to CSE 3 TC-109 T-H: 1:00-2:25 PM 35 J33486 CSE-330 Digital Logic Circuits 3 TC-305 M-W-F: 9:00-9:55 AM 26 K69880 CSE-332 Foundations of Semiconductors 3 TC-305 T-H: 1:00-2:25 PM 24 K69880 CSE-334 Elec Measurement & Design 3 TC-212 T-H: 11:00-12:25 PM 25 H99118 CSE-430 Bioinformatics in Computer 3 TC-206 Thu: 9:30-11:00 AM 16 B86590 CSE-432 Analog Circuits Design 3 TC-309 M-W-F: 2:00-2:55 PM 18 K69880 CSE-433 Digital Signal Processing 3 TC-206 T-H: 2:00-3:25 PM 18 H99118 CSE-434 Advanced Electronics Systems 3 TC-213 M-W-F: 1:00-1:55 PM 26 B78880 CSE-436 Automatic Control and Design 3 TC-305 M-W-F: 10:00-10:55 AM 29 J33486 CSE-437 Operating Systems 3 TC-303 T-H: 1:00-2:25 PM 17 A77587 CSE-438 Advd Logic & Microprocessor 3 TC-213 M-W-F: 11:00-11:55 AM 35 B78880 CSE-439 Special Topics in CSE 3 TC-206 M-W-F: 10:00-10:55 AM 22 J33486 Table 2.26 Data in the Student Table student_id student_name gpa credits major schoolYear email A78835 Andrew Woods 3.26 108 Computer Science Senior awoods@college.edu A97850 Ashly Jade 3.57 116 Information System Engineering Junior ajade@college.edu B92996 Blue Valley 3.52 102 Computer Science Senior bvalley@college.edu H10210 Holes Smith 3.87 78 Computer Engineering Sophomore hsmith@college.edu J77896 Erica Johnson 3.95 127 Computer Science Senior ejohnson@college.edu
  6. 78 Chapter 2 Introduction to Databases Table 2.27 Data in the StudentCourse Table s_course_id student_id course_id credit major 1000 H10210 CSC-131D 3 CE 1001 B92996 CSC-132A 3 CS/IS 1002 J77896 CSC-335 3 CS/IS 1003 A78835 CSC-331 3 CE 1004 H10210 CSC-234B 3 CE 1005 J77896 CSC-234A 3 CS/IS 1006 B92996 CSC-233A 3 CS/IS 1007 A78835 CSC-132A 3 CE 1008 A78835 CSE-432 3 CE 1009 A78835 CSE-434 3 CE 1010 J77896 CSC-439 3 CS/IS 1011 H10210 CSC-132A 3 CE 1012 H10210 CSC-331 3 CE 1013 A78835 CSC-335 3 CE 1014 A78835 CSE-438 3 CE 1015 J77896 CSC-432 3 CS/IS 1016 A97850 CSC-132B 3 ISE 1017 A97850 CSC-234A 3 ISE 1018 A97850 CSC-331 3 ISE 1019 A97850 CSC-335 3 ISE 1020 J77896 CSE-439 3 CS/IS 1021 B92996 CSC-230 3 CS/IS 1022 A78835 CSE-332 3 CE 1023 B92996 CSE-430 3 CE 1024 J77896 CSC-333A 3 CS/IS 1025 H10210 CSE-433 3 CE 1026 H10210 CSE-334 3 CE 1027 B92996 CSC-131C 3 CS/IS 1028 B92996 CSC-439 3 CS/IS • course_id: VARCHAR2(10) • credit: NUMBER(1, 0)—precision = 1, scale = 0 (1-bit integer) • major: VARCHAR2(40) Your finished Course, Student, and StudentCourse tables are shown in Figures 2.56, 2.57 and 2.58, respectively. 2.11.3 Create Constraints Between Tables Now it is the time for us to set up the relationships between our five tables using the primary and foreign keys. Since we have already selected the primary key for each table when we create and build those tables, therefore we only need to take care of the foreign keys and connect them with the associated primary keys in the related tables. Let’s start from the first table, LogIn table.
  7. 2.11 Create Oracle 10g XE Sample Database 79 Figure 2.56 Completed Course table. Figure 2.57 Completed Student table.
  8. 80 Chapter 2 Introduction to Databases Figure 2.58 Completed StudentCourse table. 2.11.3.1 Create Constraints Between LogIn and Faculty Tables Now let’s create the constraints between the LogIn and the Faculty tables by using a foreign key. Create a foreign key for the LogIn table and connect it to the primary key in the Faculty table. The faculty_id is a foreign key in the LogIn table but it is a primary key in the Faculty table. A one-to-many relationship exists between the faculty_id in the Faculty table and the faculty_id in the LogIn table. Log on the Oracle Database 10g XE using the customer user name, CSE_DEPT, and the customer database password, and then open the home page of the Oracle Database 10g XE. Click on the Object Browser icon and select Browse|Table to list all tables. Select the LogIn table from the left pane to open it, click the Constraints tab and then click the Create button that is the first button in the second row. Enter LOGIN_FACULTY_FK into the Constraint Name box, and select the Foreign Key from the Constraint Type box, which is shown in Figure 2.59. Check the On Delete Cascade checkbox. Then select the FACULTY_ID from the LogIn table as the foreign key column. Select the FACULTY
  9. 2.11 Create Oracle 10g XE Sample Database 81 Figure 2.59 Create the foreign key between the LogIn and the Faculty table. table from the Reference Table Name box as the reference table, and select the FACULTY_ID from the Reference Table Column List as the reference table column. Your finished Add Constraint window should match the one shown in Figure 2.59. Click on Next to go to the next window, and then click on the Finish button to confirm this foreign key’s creation. 2.11.3.2 Create Constraints Between LogIn and Student Tables The relationship between the Student table and the LogIn table is a one-to-many rela- tionship. The student_id in the Student table is a primary key, but the student_id in the LogIn table is a foreign key. Multiple student_ids can exists in the LogIn table, but only one or a unique student_id can be found from the Student table. To create a foreign key from the LogIn table and connect it to the primary key in the Student table, open the LogIn table if it is not opened and click on the Constraints tab, and then click on the Create button that is the first button in the second row to open the Add Constraint window. Enter LOGIN_STUDENT_FK into the Constraint Name box, and select the Foreign Key from the Constraint Type box, which is shown in Figure 2.60. Check the On Delete Cascade checkbox. Then select the STUDENT_ID from the LogIn table as the foreign key column. Select the STUDENT table from the Reference Table Name box as the reference table, and select the STUDENT_ID from the Reference Table Column List as the reference table column. Your finished Add Constraint window should match the one shown in Figure 2.60.
  10. 82 Chapter 2 Introduction to Databases Figure 2.60 Create the foreign key between the LogIn and the Student table. Figure 2.61 Finished foreign key creation window for the LogIn table. Recall that when we created the LogIn table in Section 2.11.2.1, we emphasized that for the blank fields in both faculty_id and student_id columns, don’t place a NULL into these fields and just leave those fields blank. The reason for this is that an ALTER TABLE command will be issued when you create a foreign key for the LogIn table, and the NULL cannot be recognized by this command, therefore an error ORA-02298 occurs and your creation of a foreign key will fail. Click on the Next button to go to the next window, and then click on the Finish button to confirm this foreign key’s creation. Your finished foreign key creation window for the LogIn table should match the one shown in Figure 2.61.
  11. 2.11 Create Oracle 10g XE Sample Database 83 2.11.3.3 Create Constraints Between Course and Faculty Tables The relationship between the Faculty table and the Course table is a one-to-many rela- tionship. The faculty_id in the Faculty table is a primary key, but it is a foreign key in the Course table. This means that only a unique faculty_id exists in the Faculty table but multiple faculty_ids can exist in the Course table since one faculty can teach multiple courses. Open the Course table by clicking it from the left panel. Click on the Constraints tab and then click the Create button. Enter COURSE_FACULTY_FK into the Constraint Name box, and select the Foreign Key from the Constraint Type box, which is shown in Figure 2.62. Check the On Delete Cascade checkbox. Then select the FACULTY_ID from the Course table as the foreign key column. Select the FACULTY table from the Reference Table Name box as the reference table, and select the FACULTY_ID from the Reference Table Column List as the reference table column. Your finished Add Constraint window should match the one shown in Figure 2.62. Click on the Next button to go to the next window, and then click on the Finish button to confirm this foreign key’s creation. Your finished foreign key creation window for the Course table should match the one shown in Figure 2.63. 2.11.3.4 Create Constraints Between StudentCourse and Student Tables The relationship between the Student table and the StudentCourse table is a one-to-many relationship. The primary key student_id in the Student table is a foreign key in the Figure 2.62 Create the foreign key between the Course and the Faculty table.
  12. 84 Chapter 2 Introduction to Databases Figure 2.63 Finished foreign key creation window for the Course table. StudentCourse table since one student can take multiple different courses. In order to create this relationship by using the foreign key, first let’s open the StudentCourse table. Click on the Constraints tab and then click the Create button that is the first button on the second row. Enter STUDENTCOURSE_STUDENT_FK into the Constraint Name box, and select the Foreign Key from the Constraint Type box, which is shown in Figure 2.64. Check the On Delete Cascade checkbox. Then select the STUDENT_ID from the StudentCourse table as the foreign key column. Select the STUDENT table from the Reference Table Name box as the reference table, and select the STUDENT_ID from the Reference Table Column List as the reference table column. Your finished Add Constraint window should match the one shown in Figure 2.64. Click on the Next button to go to the next window, and then click on the Finish button to confirm this foreign key’s creation. 2.11.3.5 Create Constraints Between StudentCourse and Course Tables The relationship between the Course table and the StudentCourse table is a one-to-many relationship. The primary key course_id in the Course table is a foreign key in the StudentCourse table since one course can be taken by multiple different students. By using the StudentCourse table as an intermediate table, a many-to-many relationship can be built between the Student table and the Course table. To create this relationship by using the foreign key, open the StudentCourse table by clicking on it from the left pane. Click the Constraints tab and then click on the Create button that is the first button on the second row. Enter STUDENTCOURSE_ COURSE_FK into the Constraint Name box, and select the Foreign Key from the Constraint Type box, which is shown in Figure 2.65. Check the On Delete Cascade check- box. Then select the COURSE_ID from the StudentCourse table as the foreign key column. Select the COURSE table from the Reference Table Name box as the refer- ence table, and select the COURSE_ID from the Reference Table Column List as the
  13. 2.11 Create Oracle 10g XE Sample Database 85 Figure 2.64 Create the foreign key between the StudentCourse and the Student table. Figure 2.65 Create the foreign key between the StudentCourse and the Course table.
  14. 86 Chapter 2 Introduction to Databases Figure 2.66 Finished foreign key creation window for the StudentCourse table. reference table column. Your finished Add Constraint window should match the one shown in Figure 2.65. Click on the Next button to go to the next window, and then click on the Finish button to confirm this foreign key’s creation. Your finished foreign key creation window for the StudentCourse table should match the one shown in Figure 2.66. Our customer database creation for Oracle Database 10g Express Edition is com- pleted. A completed Oracle 10g XE sample database CSE_DEPT that is represented by a group of table files can be found in the folder Oracle located at the accompanying ftp web site (see Chapter 1). Refer to Appendix F to get more detailed information if you want to use this sample database in your Visual C# applications. At this point, we have finished developing and creating all sample databases we need to use later. All of these sample databases will be utilized for different applications we will develop in this book. Since the Oracle Database 10g XE is very different with other databases such as Microsoft Access and SQL Server 2005, you need to refer to Appendix F to get a clear picture about how to use the CSE_DEPT Oracle database files. Refer to Appendix D to get the knowledge on how to use the Utilities of Oracle Database 10g XE to Unload the five tables to five Text files, and how to Load those five table files into a new customer Oracle database to create a new customer Oracle database easily. 2.12 CHAPTER SUMMARY A detailed discussion and analysis of the structure and components about databases were provided in this chapter. Some key technologies in developing and designing databases were also given and discussed. The procedures and components to develop a relational database were analyzed in detailed with some real data tables in our sample database CSE_DEPT. The process in developing and building a sample database was discussed in detail with the following points: • Defining relationships • Normalizing the data • Implementing the relational database
  15. Homework 87 In the second part of this chapter, three sample databases that were developed with three popular database management systems such as Microsoft Access, SQL Server 2005, and Oracle Database 10g XE were provided in detail. All of these three sample databases will be used throughout the whole book. HOMEWORK I. True/False Selections ____1. Database development process involves project planning, problem analysis, logical design, physical design, implementation, and maintenance. ____2. Duplication of data creates problems with data integrity. ____3. If the primary key consists of a single column, then the table in 1NF is automatically in 2NF. ____4. A table is in first normal form if there are no repeating groups of data in any column. ____5. When a user perceives the database as made up of tables, it is called a Network Model. ____6. Entity integrity rule states that no attribute that is a member of the primary (composite) key may accept a null value. ____7. When creating data tables for the Microsoft Access database, a blank field can be kept as a blank without any letter in it. ____8. To create data tables in SQL Server database, a blank field can be kept as a blank without any letter in it. ____9. The name of each data table in SQL Server database must be prefixed by the keyword dbo. ___10. The Sequence object in Oracle database is used to automatically create a sequence of numeric numbers that work as the primary keys. II. Multiple Choices 1. There are many advantages to using an integrated database approach over that of a file pro- cessing approach. These include a. Minimizing data redundancy b. Improving security c. Data independence d. All of the above 2. The entity integrity rule implies that no attribute that is a member of the primary key may accept _______. a. Null value b. Integer data type c. Character data type d. Real data type 3. Reducing data redundancy will lead to _____. a. Deletion anomalies b. Data consistency c. Loss of efficiency d. None of the above
  16. 88 Chapter 2 Introduction to Databases 4. ______ keys are used to create relationships among various tables in a database. a. Primary keys b. Candidate keys c. Foreign keys d. Composite keys 5. In a small university the Department of Computer Science has six faculty members. However, each faculty member belongs to only the Computer Science Department. This type of relation- ship is called _________. a. One-to-one b. One-to-many c. Many-to-many d. None of the above 6. The Client Server databases have several advantages over the File Server databases. These include ________. a. Minimizing chances of crashes b. Provision of features for recovery c. Enforcement of security d. Efficient use of the network e. All of the above 7. One can create the foreign keys between tables ______. a. Before any table can be created b. When some tables are created c. After all tables are created d. With no limitations 8. To create foreign keys between tables, first one must select the table that contains a _______ key and then select another table that has a _______ key. a. Primary, foreign b. Primary, primary c. Foreign, primary d. Foreign, foreign 9. The data type VARCHAR2 in Oracle database is a string variable with _______. a. Limited length b. Fixed length c. Certain number of letters d. Varying length 10. For data tables in Oracle Database 10g XE, a blank field must be ________. a. Indicated by NULL b. Kept as a blank c. Either by NULL or a blank d. Avoided
  17. Homework 89 III. Exercises 1. What are the advantages to using an integrated database approach over that of a file processing approach? 2. Define entity integrity and referential integrity. Describe the reasons for enforcing these rules. 3. Entities can have three types of relationships: one-to-one, one-to-many, and many-to-many. Define each type of relationship. Draw ER diagrams to illustrate each type of relationship. 4. List all steps to create foreign keys between data tables for SQL Server database in the SQL Server Management Studio Express. Illustrate those steps by using a real example. For instance, how to create foreign keys between the LogIn and the Faculty table. 5. List all steps to create foreign keys between data tables for Oracle database in the Oracle Database 10g XE. Illustrate those steps by using a real example. For instance, how to create foreign keys between the StudentCourse and the Course table.
  18. Chapter 3 Introduction to ADO.NET It has been a long road for software developers to generate and implement sophisticated data processing techniques to improve and enhance data operations. The evolution of data access Application Programming Interface (API) is also a long process focusing predominantly on how to deal with relational data in a more flexible way. The methodol- ogy development has been focused on Microsoft-based APIs such as Open Database Connectivity (ODBC), OLEDB, Microsoft Jet, Data Access Objects (DAO), and Remote Data Objects (RDO), in addition to many non-Microsoft-based APIs. These APIs did not bridge the gap between object-based and semistructured (XML) data programming needs. Combine this problem with the task of dealing with many different data stores, nonrelational data like XML and applications applying across multiple languages are challenging topics, and one should have a tremendous opportunity for complete rearchi- tecture. The ADO.NET is a good solution for these challenges. ADO.NET 2.0 was considered as a full solution between the relational database API and object-oriented data access API, which was released with the .NET Framework 2.0 and Visual Studio.NET 2005. Today the updated version of the ADO.NET is 3.5, which is released with the .NET Framework 3.5 and Visual Studio.NET 2008. In this chapter, first we will provide a detailed review about the history of ADO.NET, and then a full discussion and description about the components and architectures of ADO.NET 2.0 is given since most data components used for today’s database actions are still covered by the ADO.NET 2.0. Finally we introduce some new features and components included in the ADO.NET 3.5. 3.1 ADO AND ADO.NET ActiveX Data Object (ADO) is developed based on Object Linking and Embedding (OLE) and Component Object Model (COM) technologies. COM is used by developers to create reusable software components, link components together to build applications, and take advantage of Windows services. For the last decade, ADO has been the pre- Practical Database Programming With Visual C#.NET, by Ying Bai Copyright © 2010 the Institute of Electrical and Electronics Engineers, Inc. 91
  19. 92 Chapter 3 Introduction to ADO.NET ferred interface for Visual Basic programmers to access various data sources, with ADO 2.7 being the latest version of this technology. The development history of data accessing methods can be traced back to the mid-1990s with DAO and then followed by RDO, which was based on ODBC. In the late 1990s, the ADO that is based on OLEDB was developed. This technology is widely applied in most object-oriented programming and database applications during the last decade. ADO.NET 3.5 is the updated version of ADO.NET, and it is based mainly on the Microsoft .NET Framework 3.5. The underlying technology applied in ADO.NET 3.5 is very different from the COM-based ADO. The ADO.NET Common Language Runtime provides bidirectional, transparent integration with COM. This means that COM and ADO.NET applications and components can use functionality from each system. But the ADO.NET 3.5 Framework provides developers with a significant number of benefits including a more robust, evidence-based security model, automatic memory management native Web services support, and Language Integrated Query (LINQ). For new develop- ment, the ADO.NET 3.5 is highly recommended as a preferred technology because of its powerful managed runtime environment and services. This chapter will provide a detailed introduction to ADO.NET 2.0 and ADO.NET 3.5 and their components, and these components will be utilized for the rest of the book. In this chapter, you will: • Learn the basic classes in ADO.NET 2.0 and its architecture. • Learn the different ADO.NET 2.0 data providers. • Learn about the Connection and Command components. • Learn about the Parameters collection component. • Learn about the DataAdapter and DataReader components. • Learn about the DataSet and DataTable components. • Learn about the ADO.NET 3.5 Entity Framework (EF). • Learn about the ADO.NET 3.5 Entity Framework Tools (EFT). • Learn about the ADO.NET Entity Data Model (EDM). First let’s take a closer look at ADO.NET 2.0 and have a global picture of its components. 3.2 OVERVIEW OF ADO.NET 2.0 ADO.NET is a set of classes that expose data access services to the Microsoft .NET programmer. ADO.NET provides a rich set of components for creating distributed, data- sharing applications. It is an integral part of the Microsoft .NET Framework, providing access to relational, XML, and application data. ADO.NET supports a variety of devel- opment needs, including the creation of front-end database clients and middle-tier busi- ness objects used by applications, tools, languages, or Internet browsers. All ADO.NET classes are located at the System.Data namespace with two files named System.Data.dll and System.Xml.dll. When compiling code that uses the System.Data namespace, reference both System.Data.dll and System.Xml.dll.
Đồng bộ tài khoản