Practical Database Programming With Visual C#.NET- P1

Thể loại: Cơ sở dữ liệu
Lượt xem: 24,146Lượt tải: 2Số trang: 50

Mô tả tài liệu

Cơ sở dữ liệu thực tế Lập trình với Visual C #. NET giải thích rõ ràng những cân nhắc và các ứng dụng trong lập trình cơ sở dữ liệu với Visual C # NET 2008. Và trong việc phát triển cơ sở dữ liệu quan hệ như Microsoft Access, SQL Server, và Oracle Database. Sidestepping cách tiếp cận truyền thống của việc sử dụng khối lượng lớn các mã, Ying Bái sử dụng cả hai thiết kế Công cụ và Wizards Visual Studio.NET pred của đối tượng và phương pháp thời gian thực để kết hợp hơn sáu...

Tóm tắt nội dung

Practical database with Visual C#.NET / Ying to Use the Source Code and Sample Databases 6 2 to Databases 11 2.1 What Are Databases and Database Develop a Database 14 2.3 Sample Database 15 2.3.1 Data Model 18 2.8.2 SQL Server Databases Data Files 30 2.8.3 Oracle Databases Data Files 33 2.9 Create Microsoft Access Sample Database 36 2.10 Create Microsoft SQL Server 2005 Sample Database Create Between Faculty and Course Tables 59 2.11 Create Oracle 10g XE Sample Database 63 2.11.1 Create Oracle User Database 64 2.11.2 Add New Data Tables into Oracle User Database 65 3.4.1 Data Provider SQL Server Data Provider Oracle Data Provider ADO.NET 3.5 Entity Data Model Using ADO.NET 3.5 Entity Data Model Wizard 132 4.6.2 LINQ to SQL Database Data Selection Query Data Insertion Query Data Updating Query Data Deletion Query 204 5 Data Selection Query with Visual C#.NET 235 PART I Data Query with Visual Studio Design Tools and Wizards 236 5.3 Build a Sample Database with SQL Server Database 251 5.5 Query and Display Data Using the Control 263 5.8 Develop Codes to Query Data Using Fill() Method 274 5.9 Use Return a Single Value to Query Data for LogIn Form 276 5.11 Bind Data to Controls in Faculty Form 282 5.12 Develop Codes to Query Data from Faculty Table Develop Codes to Query Data Using SQL SELECT Method Develop Codes to Query Data Using LINQ Method 287 5.14 Binding Data to Controls in Course Form 291 5.15 Develop Codes to Query Data for Course Form Query Data from the Course Table Using 5.15.2 Query Data from the Course Table Using LINQ Method Select and Add Oracle Database 10g XE as Data Source 300 PART II Data Query with Runtime Objects Procedure of Building a Using Runtime 5.18 Query Data Using Runtime Objects to Microsoft Access 2007 Database Query Data Using Runtime Objects for LogIn Form 307 Query Data 310 Data Query Data Using Runtime Objects for Faculty Form Query Data Using Runtime Objects for Course Form Query Data Using Runtime Objects for Student Form 335 5.19 Query Data Using Runtime Objects to SQL Server Database Migrating from Access to SQL Server and Oracle Databases Query Data Using General Runtime Objects Query Data Using the General Runtime Objects for 5.19.2.3 Query Data Using General Runtime Objects for Faculty 5.19.2.4 Query Data Using General Runtime Objects for Course 5.19.2.6 Query Data Using General Runtime Objects for Student 5.19.2.7 Query Data Using Stored Query Data Using LINQ to SQL Technique Query Data Using LINQ to SQL for LogIn Form Query Data Using LINQ to SQL for Faculty Form Query Data Using Joined LINQ to SQL for Course 5.19.3.6 Query Data Using LINQ to SQL Stored for Student 5.20 Query Data Using Runtime Objects to Oracle Database Query Data Using General Runtime Objects Query Data Using General Runtime Objects for LogIn 5.20.3.3 Query Data Using Runtime Objects for Faculty Form Query Data Using Runtime Objects for Course Form Stored in Oracle Database Query Data Using Oracle Package for Course Form 426 6 Data Inserting with Visual C#.NET 439 PART I Data Inserting with Visual Design Tools and Wizards 440 6.1 Insert New Data into a Database 440 6.1.2 Insert New Records into a Database Using 6.2 Insert Data into Microsoft Access Database Using Sample Project 6.2.6 and Coding for Data Insertion 451 6.2.8 Develop Codes to Insert Data Using 6.2.9 Develop Codes to Insert Data Using 6.3 Insert Data into SQL Server Database Using Sample Project 6.3.1 Modify Existing Project to Get New Data Insertion 6.3.2 Create New Form Window to Insert Data for Course 6.3.5 Confi gure and Build Data Insertion Query 476 6.3.6 Develop Codes to Insert Data Using 6.3.7 Develop Codes to Insert Data Using 6.3.8 Use Select Button in Course Form to Perform Data 6.3.9 Insert Data into Database Using Stored Modify Codes to Perform Data Insertion Using Stored 6.4 Insert Data into Oracle Database Using Sample Project PART II Data Insertion with Runtime Objects 489 6.6 Insert Data into SQL Server Database Using Runtime Objects 6.6.1 Add Inserting Data Form Window: Insert Faculty Form 491 6.6.3 Startup Coding and Data Before Data Insertion 494 6.6.4 Insert Data into Faculty Table 498 6.7 Insert Data into Microsoft Access Database Using Runtime Objects 510 6.7.3 Modify Database String 512 6.8 Insert Data into Oracle Database Using Runtime Objects 518 6.8.3 Modify Database String 521 6.9 Insert Data into Database Using LINQ Queries 526 6.9.1 Insert Data into SQL Server Database Using LINQ to SQL 6.10 Insert Data into Database Using Stored Insert Data into SQL Server Database Using Stored 6.10.1.1 Add an Inserting Data Form Window: Insert Course 6.10.1.2 Develop Stored of SQL Server Database 529 Data into Course Table Insert Data into Oracle Database Using Stored Develop Stored in Oracle Database 539 Data into Course Table 543 7 Data Updating and Deleting with Visual C#.NET 551 PART I Data Updating and Deleting with Visual Update or Delete Data in Databases 553 7.1.1 Updating and Deleting Data in Related Tables in DataSet 553 7.1.2 Update or Delete Data in Database Using 7.1.3 Update or Delete Data in Database Using 7.2 Update and Delete Data for Microsoft Access Database Bind Data for All Textboxes of Faculty Form Window Build Data Updating Query Function Build Data Deleting Query Function 559 7.2.5 Develop Codes to Update Data Using 7.2.6 Develop Codes to Update Data Using 7.2.7 Develop Codes to Delete Data Using DBDirect 7.2.8 Develop Codes to Delete Data Using 7.3 Update and Delete Data for SQL Server Database 568 7.4 Update and Delete Data for Oracle Database 572 PART II Data Updating and Deleting with Runtime Objects 572 7.6 Update and Delete Data for SQL Server Database Using Runtime 7.6.1 Update Data in Faculty Table for SQL Server Database Develop Codes to Update Data 577 7.6.2 Delete Data from Faculty Table for SQL Server Database Develop Codes to Delete Data Validate Data Updating and Deleting 581 7.7 Update and Delete Data for Oracle Databases Using Runtime 7.8 Update and Delete Data in Database Using Stored 589 7.8.1 Update and Delete Data in Access Database Using Stored Database 592 7.8.2 Update and Delete Data in SQL Server Database Using 7.8.2.2 Develop Stored Procedure in SQL Server Database Call Stored Procedure to Perform Data Updating and 7.8.3 Update and Delete Data in Oracle Database Using Stored 7.8.3.2 Develop Stored Procedure in Oracle Database Call Stored to Perform Data Updating and 7.9 Update and Delete Data in Databases Using LINQ to SQL Query 615 8 Accessing Data in ASP.NET 625 8.3 Develop ASP.NET Web to Select Data from SQL Server 633 8.3.2 Develop Codes to Access and Select Data from Database 635 8.4 Develop ASP.NET Web to Insert Data into SQL Server 661 8.4.2 Develop Codes to Perform Data Insertion Function 663 8.5 Develop Web to Update and Delete Data in SQL Server Develop Codes to Perform Data Deleting 681 8.6 Develop ASP.NET Web with LINQ to SQL Query 683 8.6.3 Coding for Data Selection Query 687 8.6.4 Coding for Data Insertion Query 688 8.6.5 Coding for Data Updating and Deleting Queries 689 8.7 Develop ASP.NET Web to Select Data from Oracle 692 8.8 Develop ASP.NET Web to Insert Data into Oracle 700 8.8.2 Modify Codes to Some Methods on Faculty Page 701 8.9 Develop ASP.NET Web to Update and Delete Data in Oracle Databases 708 8.9.1 Modify Project to Perform Data Updating 708 8.9.2 Develop Stored to Perform Data Deleting Delete Cascade in Data Table 715 9.3 Build ASP.NET Web Service Projects to Access SQL Server Database 726 9.3.7 Develop the Codes for Web Methods to Perform the Web Services Develop Codes to Perform Database Queries 741 9.3.8 Develop Stored to Perform the Data Query Develop Code to Use the Web Service 755 9.4 Build ASP.NET Web Service Project to Insert Data into SQL Server Database 772 9.4.2 Web Service Project Procedure Develop and Modify First Web Method Develop and Modify Third Web Method 9.5 Build ASP.NET Web Service to Update and Delete Data for SQL Server Database 805 9.5.2 Modify Related Web Methods 807 9.8 Build ASP.NET Web Service Project to Access Oracle Database Modifi cations to Codes in Web Method 847 9.10 Build ASP.NET Web Service Project to Insert Data into Oracle Database 854 9.12 Build ASP.NET Web Service to Update and Delete Data for Oracle Database and to access and data against different provides support to develop Web and Web services in ASP.NET to develop practical and database with Visual C#.NET 2008 and databases such as Microsoft Access, SQL Server 2005, and Oracle ations and in database with Visual C# 2008 with authentic clear picture as how to handle the database issues in Visual C#.NET 2008 in learning and practical database programs, and to avoid the caused by using huge blocks of codes in the database books. 2. A real completed sample database CSE_DEPT with three versions Access 2007, SQL Server 2005 SP2, and Oracle Database 10 g XE Release 2) is provided and used to design and build a practical database are The new database query technique LINQ API, which includes LINQ to Objects, LINQ 5. More than 60 real sample database projects are covered in the book with Microsoft Access, SQL Server 2005, and Oracle Database 10 g Express Edition 7. Various actual data providers are discussed and in the sample projects, such as the SQL Server and Oracle data Server or Oracle the real SQL Server and Oracle data providers are to connect to the Visual C#.NET 2008 directly to perform data been able to develop and build and practical database with college students or beginning who are new to Visual and them to learn and master database with Visual C#.NET easily and people to develop and build database - related but not database Unlike most database books on the current market, which discuss and present database with huge blocks of codes from college students, how to develop and practical database programs in Visual Instead, a simple and easy way to create database programs using the design tools can be developed to enable students to build and practical database programs There are many different database books available on the Database With Visual C#.NET, by Ying the database method — Visual 2008 Design Tools and Wizards — and an advanced database method — In the second method, all database - related objects are in learning and practical database programs, and to avoid the ples: Microsoft Access 2007, SQL Server 2005 Express SP2, and Oracle Database 10 g Unlike database books, in which some 4. The new database query LINQ API, which includes LINQ to Objects, LINQ to 5. The various actual data providers are discussed and in the sample projects, such as the SQL Server and Oracle data SQL Server or Oracle the real SQL Server and Oracle data providers are utilized to connect to the Visual C#.NET 2008 directly to perform data More than 60 real sample database projects are covered with detailed practical and database with Visual C#.NET 2008 and databases such as Microsoft Access, SQL Server 2005, and Oracle Database key in and designing databases are also The and used to develop a practical database with three database versions such as Microsoft Access, SQL Server 2005, and Oracle Database 10 g XE are analyzed in detail with some real data tables in the sample database on how to use in ADO.NET to develop data - driven data such as OleDb, ODBC, SQL Server, and Oracle, are discussed in ADO.NET 3.5 EF, Entity Data Model, and Item template, Wizard and Designer, • Starting in Chapter 5 , the real database with Visual C#.NET 2008 such as data selection queries are provided and Part I contains the detailed on how to develop data - driven method, used in and building data - driven Chapter 6 provides detailed and analyses about three popular data methods with three different databases — Microsoft Access, SQL Server 2005, and used to how to perform the data insertion into three different Microsoft Access, SQL Server 2005, and Oracle Database 10 g XE. data methods are also discussed in this chapter to confi rm the data Chapter 7 provides and analyses on three popular data updating and deleting to update and delete data directly from the databases tables in the DataSet to the tables in the database to update or delete data in the database directly perform updating and deleting data against three different Microsoft Access, SQL Server 2005, and Oracle Database 10 g methods are also discussed in this chapter to confi rm the data updating and deleting The key points in the data updating and deleting actions against a database such as the order to execute data updating and deleting between the parent Updating and deleting data using LINQ to DataSet and LINQ to SQL queries are also discussed and in this chapter Starting from Section 8.3 , the detailed and building process of ASP.NET Web to access databases are discussed with six actual Web SQL Server and Oracle, are utilized as the target databases for those Two popular SQL Server and Oracle, are discussed and perform the desired data actions such as Select, Insert, Update, and Delete This book is designed for both college students who are new to database with Visual C#.NET and database who have Chapters 2 and 3 provide the on database and The data are more suitable for students and who are new to database covers a lot of coding to perform the different data actions against and Web services to access and data via the 5 , 6 , and 7 since these cover the in database Server 2005 SP2, and Oracle Database 10 g XE Release 2 objects method and some database such as ASP.NET Web services are discussed and analyzed with 24 real database program for SQL Server 2005 and Oracle Database 10 g XE. HOW TO USE THE SOURCE CODE AND SAMPLE DATABASES SQL Server 2005 Studio Express, and Oracle Database 10 g Express • Three versions of sample database — and Oracle • Appendix D : Provides detailed on how to create user database in Oracle database into Visual C#.NET using the Visual design tools and • Appendix F : Provides detailed on how to use three sample sample database fi les, such as , , and Oracle to Databases of huge amounts of genome data, currently stored in databases around the Data Model that database really took Database With Visual C#.NET, by Ying Bai 12 Chapter 2 to What are databases and database databases • Various to a database • Data Model and Entity - Model (ER) • the database • Create Microsoft Access sample database • Create Microsoft SQL Server 2005 sample database • Create Oracle sample database 2.1 WHAT ARE DATABASES AND DATABASE modern - day database is a of data stored in a and by database data retrieved in answer to queries programs, which the data in those fi les. 2.1 What Are Databases and Database les and programs were developed to delete, insert, or modify records in the Since specifi c programs were developed for specifi c data, these programs this all data belonging to an is stored in a single are also stored within the the data in the Data Sharing The data in the database is available to a large number of users who can 2. Data Since all the related data exists in a single database, there Since data is stored in a single database, enforcing data integrity becomes much to the database through providing various levels of data Data Providing data is a major objective for any database Data implies that even if the physical structure of a database changes, 14 Chapter 2 to DEVELOP A DATABASE need a Physical Design Develop physical data Design Choose a data model and develop a schema based on the the database; identify that will represent fi elds in a table; and identify each entity 2.3 Sample Database 15 4. Physical Design Develop physical data specify fi le and data 2.1 to 2.5 show sample data tables stored in this data in CSE_DEPT database is stored in fi ve tables — LogIn, Faculty, Course, 16 Chapter 2 to Computers in Society 3 TC-301 M-W-F: 1:00-1:55 PM 25 B66750 CSC-132B to 3 TC-302 T-H: 1:00-2:25 PM 21 B78880 CSC-232A I 3 TC-305 T-H: PM 28 B66750 CSC-232B I 3 TC-303 T-H: PM 17 A77587 CSC-234A Data Structure & 3 TC-302 M-W-F: 9:00-9:55 AM 25 B78880 CSC-234B Data Structure & 3 TC-114 T-H: PM 15 J33486 CSC-320 Object Oriented 3 TC-301 T-H: 1:00-2:25 PM 22 B66750 CSC-335 Internet 3 TC-303 M-W-F: 25 B66750 CSC-439 Database Systems 3 TC-206 M-W-F: 1:00-1:55 PM 18 B86590 CSE-138B to CSE 3 TC-109 T-H: 1:00-2:25 PM 35 J33486 Chapter 2 to Data Model A data model is like a blueprint for a database and various data and on the data. a user perceives the database as made up of a database jargon for and are a good vehicle for the database design to the end user or CSE_Dept database: LogIn, Faculty, Course, and A database is made up of related keys for the CSE_DEPT database are shown in Table 2.6 . Primary keys provide a tuple - level mechanism in the Chapter 2 to two tables Course and Faculty in the sample database 2.7 Course (Partial Data Shown) Faculty (Partial Data Shown) CSC-234A Data Structure & B78880 This database design assumes that the course table only contains courses taught by CSC-234A Data Structure & B78880 22 Chapter 2 to 2.5 in CSE_DEPT Database With Visual to Use the Source Code and Sample to What Are Databases and Database Develop a Data SQL Server Data Oracle Data Files 2.9 Create Microsoft Access Sample Create Microsoft SQL Server 2005 Sample Create Between Faculty and Course Create Oracle 10g XE Sample Create Oracle User Add New Data Tables into Oracle User Data SQL Server Data Oracle Data ADO.NET 3.5 Entity Data Using ADO.NET 3.5 Entity Data Model LINQ to SQL Database Data Selection Data Insertion Data Updating Data Deletion Query 5 Data Selection Query with Visual I Data Query with Visual Studio Design Tools and Build a Sample Database with SQL Server Query and Display Data Using the Develop Codes to Query Data Using Fill() Use Return a Single Value to Query Data for LogIn Form 5.11 Bind Data to Controls in Faculty Form 5.12 Develop Codes to Query Data from Faculty Develop Codes to Query Data Using SQL SELECT Develop Codes to Query Data Using LINQ Binding Data to Controls in Course Form 5.15 Develop Codes to Query Data for Course Query Data from the Course Table Using Query Data from the Course Table Using LINQ Select and Add Oracle Database 10g XE as Data II Data Query with Runtime Procedure of Building a Using Runtime Query Data Using Runtime Objects to Microsoft Access 2007 Query Data Using Runtime Objects for LogIn Coding for Method 1: Using to Query Coding for Method 2: Using to Query Query Data Using Runtime Objects for Faculty Query Data Using Runtime Objects for Course Query Data Using Runtime Objects for Student Form 5.19 Query Data Using Runtime Objects to SQL Server Migrating from Access to SQL Server and Oracle Query Data Using General Runtime Query Data Using the General Runtime Objects for LogIn Query Data Using General Runtime Objects for Faculty Query Data Using General Runtime Objects for Course Retrieve Data from Multiple Tables Using Joined Tables Query Data Using General Runtime Objects for Student Query Data Using Stored Query Data Using LINQ to SQL Create Entity Classes and Connect to Query Data Using LINQ to SQL for LogIn Query Data Using LINQ to SQL for Faculty Query Data Using Joined LINQ to SQL for Course Query Data Using LINQ to SQL Stored for Student Form 5.20 Query Data Using Runtime Objects to Oracle Query Data Using General Runtime Query Data Using General Runtime Objects for LogIn Query Data Using Runtime Objects for Faculty Query Data Using Runtime Objects for Course Stored in Oracle Database Query Data Using Oracle Package for Course Form 6 Data Inserting with Visual I Data Inserting with Visual Design Tools and Insert New Data into a Insert New Records into a Database Using Insert New Records into a Database Using Insert Data into Microsoft Access Database Using Sample Project and Coding for Data Configure and Build Data Inserting Develop Codes to Insert Data Using Develop Codes to Insert Data Using Insert Data into SQL Server Database Using Sample Project Modify Existing Project to Get New Data Insertion Create New Form Window to Insert Data for Course Project and Validate Data Before Data Configure and Build Data Insertion Develop Codes to Insert Data Using Develop Codes to Insert Data Using Use Select Button in Course Form to Perform Data Insert Data into Database Using Stored Modify Codes to Perform Data Insertion Using Stored Insert Data into Oracle Database Using Sample Project II Data Insertion with Runtime Insert Data into SQL Server Database Using Runtime Objects Add Inserting Data Form Window: Insert Faculty Startup Coding and Data Before Data Insert Data into Faculty Table 6.7 Insert Data into Microsoft Access Database Using Runtime Modify Database Insert Data into Oracle Database Using Runtime Modify Database Insert Data into Database Using LINQ Insert Data into SQL Server Database Using LINQ to SQL Insert Data into Database Using Stored Insert Data into SQL Server Database Using Stored Add an Inserting Data Form Window: Insert Course Develop Stored of SQL Server Develop Codes to Call Stored to Insert Data into Course Insert Data into Oracle Database Using Stored Develop Stored in Oracle Develop Codes to Call Stored to Insert Data into Course Table 7 Data Updating and Deleting with Visual I Data Updating and Deleting with Visual Design Tools and Update or Delete Data in Updating and Deleting Data in Related Tables in Update or Delete Data in Database Using DBDirect and Update or Delete Data in Database Using Update and Delete Data for Microsoft Access Bind Data for All Textboxes of Faculty Form Build Data Updating Query Build Data Deleting Query Develop Codes to Update Data Using DBDirect Develop Codes to Update Data Using Develop Codes to Delete Data Using DBDirect Develop Codes to Delete Data Using Update and Delete Data for SQL Server Update and Delete Data for Oracle II Data Updating and Deleting with Runtime Update and Delete Data for SQL Server Database Using Runtime Update Data in Faculty Table for SQL Server Develop Codes to Update Delete Data from Faculty Table for SQL Server Develop Codes to Delete Validate Data Updating and Update and Delete Data for Oracle Databases Using Runtime Update and Delete Data in Database Using Stored Update and Delete Data in Access Database Using Stored Create Stored in Microsoft Access Update and Delete Data in SQL Server Database Using Stored Develop Stored Procedure in SQL Server Call Stored Procedure to Perform Data Updating and Update and Delete Data in Oracle Database Using Stored Develop Stored Procedure in Oracle Call Stored to Perform Data Updating and Update and Delete Data in Databases Using LINQ to SQL Query 8 Accessing Data in Develop ASP.NET Web to Select Data from SQL Server Develop Codes to Access and Select Data from Develop ASP.NET Web to Insert Data into SQL Server Develop Codes to Perform Data Insertion Develop Web to Update and Delete Data in SQL Server Between Five Tables in Our Sample Develop Codes to Perform Data Develop ASP.NET Web with LINQ to SQL Coding for Data Selection Coding for Data Insertion Coding for Data Updating and Deleting Develop ASP.NET Web to Select Data from Oracle Develop ASP.NET Web to Insert Data into Oracle Modify Codes to Some Methods on Faculty Page 8.9 Develop ASP.NET Web to Update and Delete Data in Oracle Modify Project to Perform Data Develop Stored to Perform Data Delete Cascade in Data Table 9.3 Build ASP.NET Web Service Projects to Access SQL Server Develop the Codes for Web Methods to Perform the Web Develop Codes to Perform Database Develop Stored to Perform the Data Develop Code to Use the Web Build ASP.NET Web Service Project to Insert Data into SQL Server Web Service Project Develop and Modify First Web Method Develop and Modify Third Web Method Build ASP.NET Web Service to Update and Delete Data for SQL Server Modify Related Web Build ASP.NET Web Service Project to Access Oracle Build ASP.NET Web Service Project to Insert Data into Oracle Build ASP.NET Web Service to Update and Delete Data for Oracle Database