SQL Server Database Programming with Visual Basic.NET - Ying Bai - E-Book

SQL Server Database Programming with Visual Basic.NET E-Book

Ying Bai

0,0
65,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

A guide to the practical issues and applications in database programming with updated Visual Basic.NET SQL Server Database Programming with Visual Basic.NET offers a guide to the fundamental knowledge and practical techniques for the design and creation of professional database programs that can be used for real-world commercial and industrial applications. The author--a noted expert on the topic--uses the most current version of Visual Basic.NET, Visual Basic.NET 2017 with Visual Studio.NET 2017. In addition, he introduces the updated SQL Server database and Microsoft SQL Server 2017 Express. All sample program projects can be run in the most updated version, Visual Basic.NET 2019 with Visual Studio.NET 2019. Written in an accessible, down-to-earth style, the author explains how to build a sample database using the SQL Server management system and Microsoft SQL Server Management Studio 2018. The latest version of ASP.NET, ASP.NET 4.7, is also discussed to provide the most up-to-date Web database programming technologies. This important book: * Offers illustrative practical examples and detailed descriptions to aid in comprehension of the material presented * Includes both fundamental and advanced database programming techniques * Integrates images into associated database tables using a DevExpress UI tools -WindowsUI Written for graduate and senior undergraduate students studying database implementations and programming courses, SQL Server Database Programming with Visual Basic.NET shows how to develop professional and practical database programs in Visual Basic.NET 2017/Visual Basic.NET 2019.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 1152

Veröffentlichungsjahr: 2020

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Cover

About the Author

Preface

Acknowledgment

About the Companion Website

Chapter 1: Introduction

1.1 Outstanding Features About This Book

1.2 This Book Is For

1.3 What This Book Covers

1.4 How This Book Is Organized and How to Use This Book

1.5 How to Use Source Codes and Sample Database

1.6 Instructors and Customers Supports

Chapter 2: Introduction to Databases

2.1 What Are Databases and Database Programs?

2.2 Develop a Database

2.3 Sample Database

2.4 Identifying Keys

2.5 Define Relationships

2.6 ER Notation

2.7 Data Normalization

2.8 Database Components in Some Popular Databases

2.9 Create Microsoft SQL Server 2017 Express Sample Database

2.10 Chapter Summary

Homework

Chapter 3: Introduction to ADO.NET

3.1 The ADO and ADO.NET

3.2 Overview of the ADO.NET

3.3 The Architecture of the ADO.NET

3.4 The Components of ADO.NET

3.5 Chapter Summary

Homework

Chapter 4: Introduction to Language Integrated Query (LINQ)

4.1 Overview of Language Integrated Query

4.2 Introduction to LINQ Query

4.3 The Architecture and Components of LINQ

4.4 LINQ to Objects

4.4.3 LINQ and File Directories

4.5 LINQ to DataSet

4.6 LINQ to SQL

4.7 LINQ to Entities

4.7.3 The ObjectQuery Component

4.7.4 LINQ to Entities Flow of Execution

4.7.5 Implementation of LINQ to Entities

4.8 LINQ to XML

4.9 Visual Basic.NET Language Enhancement for LINQ

4.10 Chapter Summary

Homework

Chapter 5: Data Selection Query with Visual Basic.NET

PART IData Query with Visual Studio.NET Design Tools and Wizards

5.1 A Completed Sample Database Application Example

5.2 Visual Studio.NET Design Tools and Wizards

5.3 Query Data from SQL Server Database Using Design Tools and Wizards

5.4 Use Visual Studio Wizards and Design Tools to Query and Display Data

PART II Data Query with Runtime Objects

5.5 Introduction to Runtime Objects

5.6 Query Data from SQL Server Database Using Runtime Object

5.7 Chapter Summary

Homework

Chapter 6: Data Inserting with Visual Basic.NET

PART IInsert Data with Visual Basic.NET Design Tools and Wizards

6.1 Insert Data Into a Database

6.2 Insert Data into the SQL Server Database Using a Sample Project InsertWizard

PART IIData Insertion with Runtime Objects

6.3 The General Run Time Objects Method

6.4 Insert Data into the SQL Server Database Using the Run Time Object Method

6.5 Insert Data into the Database Using Stored Procedures

6.6 Insert Data into the Database Using the LINQ To SQL Method

6.7 Chapter Summary

Homework

Chapter 7: Data Updating and Deleting with Visual Basic.NET

PART I Data Updating and Deleting with Visual Studio.NET Design Tools and Wizards

7.1 Update or Delete Data Against Databases

7.2 Update and Delete Data For Microsoft SQL Server Database

PART II Data Updating and Deleting with Runtime Objects

7.3 The Run Time Objects Method

7.4 Update and Delete Data for SQL Server Database Using the Run Time Objects

7.5 Update and Delete Data against SQL Server Database Using Stored Procedures

7.6 Chapter Summary

Homework

Chapter 8: Accessing Data in ASP.NET

8.1 What is .NET Framework?

8.2 What is ASP.NET?

8.3 Develop ASP.NET Web Application to Select Data from SQL Server Databases

8.4 Develop ASP.NET Web Application to Insert Data Into SQL Server Databases

8.5 Develop Web Applications to Update and Delete Data in SQL Server Databases

8.6 Develop ASP.NET Web Applications with LINQ to SQL Query

8.7 Chapter Summary

Homework

Chapter 9: ASP.NET Web Services

9.1 What Are Web Services and Their Components?

9.2 Procedures to Build a Web Service

9.3 Build ASP.NET Web Service Project to Access SQL Server Database

9.4 Build ASP.NET Web Service Project to Insert Data Into SQL Server Database

9.5 Build ASP.NET Web Service to Update and Delete Data for SQL Server Database

9.6 Build Windows‐Based Web Service Clients to Consume the Web Services

9.7 Build Web‐Based Web Service Clients to Consume the Web Services

9.8 Chapter Summary

Homework

Appendix A: Appendix AInstall and Configure SQL Server 2017 Express DatabaseInstall and Configure SQL Server 2017 Express Database

A.1 Install SQL Server 2017 Express Database

A.2 Install SQL Server 2017 Management Studio

A.3 Configure and Setup SQL Server 2017 Express Connection Parameters

Appendix B: Appendix BDownload and Install DevExpress .NET UI ControlsDownload and Install DevExpress .NET UI Controls

Appendix C: Appendix CDownload & Install FrontPage Server Extension for Windows 10Download & Install FrontPage Server Extension for Windows 10

Appendix D: How to Use Sample Database

D.1 Use Microsoft SQL Server 2017 Express Database File

Index

End User License Agreement

List of Tables

Chapter 2

Table 2.1

LogIn table.

Table 2.2

Faculty table.

Table 2.3

Course table.

Table 2.4

Student table.

Table 2.5

StudentCourse table.

Table 2.6 Faculty table.

Table 2.7 Course (Partial data shown). Faculty (Partial data shown).

Table 2.8 Unnormalized Faculty table with repeating groups.

Table 2.9 Normalized Faculty table.

Table 2.10 The old Course table.

Table 2.11 The new Course table.

Table 2.12 The new Instructor table.

Table 2.13 The data in the LogIn table.

Table 2.14 The data in the Faculty table.

Table 2.15 The data in the Course table.

Table 2.16 The data in the Student table.

Table 2.17 The data in the StudentCourse table.

Table 2.18 The image files in the Faculty table.

Table 2.19 The image files in the Student table.

Chapter 3

Table 3.1 Namespaces for different Data Providers, DataSet and DataTable.

Table 3.2 The compatibility between the OLEDB and OLEDB.NET.

Table 3.3 The Connection classes and databases.

Table 3.4 The data types and the associated Data Provider.

Table 3.5 The different parameter mappings.

Table 3.6 Methods of the Command class.

Table 3.7 The constructors of the DataAdapter class.

Table 3.8 The public properties of the DataAdapter class.

Table 3.9 The public methods of the DataAdapter class.

Table 3.10 The events of the DataAdapter class.

Table 3.11 Popular properties of the SqlDataReader class.

Table 3.12 Popular methods of the SqlDataReader class.

Table 3.13 Popular Exceptions of the DataReader class.

Table 3.14 Popular constructors of the DataSet class.

Table 3.15 Public properties of the DataSet class.

Table 3.16 Public methods of the DataSet class.

Table 3.17 Public events of the DataSet class.

Table 3.18 Three popular constructors of the DataTable class.

Table 3.19 The popular properties of the DataTable class.

Table 3.20 The popular methods of the DataTable class.

Table 3.21 The public events of the DataTable class.

Table 3.22 The completed FacultyTable.

Chapter 4

Table 4.1 Most Often Used Standard Query Operators.

Table 4.2 LINQ Related Namespaces.

Table 4.3 Deleted record from the Faculty table.

Table 4.4 Deleted record from the LogIn table.

Table 4.5 Deleted records from the Course table.

Chapter 5

Table 5.1 Relationship between the Form and Data Table.

Table 5.2 Relationship between each form and data table.

Table 5.3 Controls on the LogIn form.

Table 5.4 Controls on the Selection form.

Table 5.5 Controls on the Faculty form.

Table 5.6 Controls on the Course form.

Table 5.7 Controls on the Student form.

Table 5.8 A part of Faculty and Course data table.

Chapter 6

Table 6.1 TableAdapter DBDirect Methods.

Chapter 7

Table 7.1 TableAdapter DBDirect Methods.

Table 7.2 Variations of Tabledapter.Update() method.

Table 7.3 The data to be recovered in the Faculty table.

Table 7.4

The data to be recovered in the LogIn table.

Table 7.5

The data to be recovered in the Course table.

Table 7.6 The data to be recovered in the StudentCourse table.

Table 7.7 The data to be recovered in the Course table.

Table 7.8 The data to be recovered in the StudentCourse table.

Table 7.9 The courses to be inserted into the Course table.

Table 7.10 The courses to be inserted into the StudentCourse table.

Chapter 8

Table 8.1 Controls for the LogIn form.

Table 8.2 Validation Controls.

Table 8.3 Controls on the Selection form.

Table 8.4 Controls on the Faculty form.

Table 8.5 Controls on the Course form.

Table 8.6 The original data for the faculty member Ying Bai in the Faculty ta...

Table 8.7 The total number of rows affected or deleted.

Table 8.8 The data to be added into the Faculty table.

Table 8.9 The data to be added into the LogIn table.

Table 8.10 The data to be added into the Course table.

Table 8.11 The data to be added into the StudentCourse table.

Chapter 9

Table 9.1 The Web Service Namespaces.

Table 9.2 The first course record to be inserted.

Table 9.3 The second course record to be inserted.

Table 9.4 The input parameters to the stored procedure.

Table 9.5 The recovered record for the original student.

Table 9.6 The deleted records for student Toney Black in all tables.

Table 9.7 Deleted data in LogIn table.

Table 9.8 Deleted data in StudentCourse table.

Table 9.9 Deleted data in Student table.

Table 9.10 The updated record for the student Tom Erica.

Table 9.11 Deleted data in Student table.

Table 9.12 Deleted data in LogIn table.

Table 9.13 Deleted data in StudentCourse table.

List of Illustrations

Chapter 1

Figure 1.1 Two study levels in the book.

Figure 1.2 Book related materials on Web site.

Chapter 2

Figure 2.1 Records and fields in a table.

Figure 2.2 One to one relationship in the LogIn and the Student tables.

Figure 2.3 One‐to‐many relationship between Faculty and Course tables.

Figure 2.4 Many‐to‐Many relationship between Student and Course tables.

Figure 2.5 Relationships in CSE_DEPT database.

Figure 2.6 Relationships are illustrated using MS Access in the CSE_DEPT dat...

Figure 2.7 Commonly used symbols for ER notation.

Figure 2.8 Converting Faulty table into 2NF by decomposing the old table in ...

Figure 2.9 Microsoft Access database illustration.

Figure 2.10 SQL Server database structure.

Figure 2.11 Syntax for creating a stored procedure in Oracle.

Figure 2.12 Connect to the SQL Server 2017 Express database.

Figure 2.13 The opened server management studio.

Figure 2.14 The new table window.

Figure 2.15 The finished LogIn table.

Figure 2.16 The design view of the Faculty table.

Figure 2.17 The completed Faculty table.

Figure 2.18 The completed Course table.

Figure 2.19 The completed Student table.

Figure 2.20 The completed StudentCourse table.

Figure 2.21 The opened Foreign Key Relationships dialog box.

Figure 2.22 The opened Tables and Columns dialog box.

Figure 2.23 The finished Tables and Columns dialog box.

Figure 2.24 The finished Foreign Key Relationships dialog.

Figure 2.25 The completed Tables and Columns dialog.

Figure 2.26 The finished Tables and Columns dialog.

Figure 2.27 The finished Tables and Columns dialog.

Figure 2.28 The finished Tables and Columns dialog.

Figure 2.29 Relationships among tables.

Figure 2.30 Create a blank solution SQL Image Solution.

Figure 2.31 Add a new project SQL Image Project into the solution.

Figure 2.32 The new added project SQL Image Project.

Figure 2.33 The database connection page.

Figure 2.34 The opened Add Connection wizard.

Figure 2.35 The connected database and dataset CSE_DEPTDataSet.

Figure 2.36 Drag and place three columns in Details format on Faculty table....

Figure 2.37 Drag and place three columns in GridView format on Faculty table...

Figure 2.38 The completed Form for adding faculty images.

Figure 2.39 The modified fimage column.

Figure 2.40 The finished Student table in the Data Source Configuration Wiza...

Figure 2.41 The completed Form for adding student images.

Chapter 3

Figure 3.1 ADO.NET LINQ Techniques.

Figure 3.2 A typical architecture of the ADO.NET.

Figure 3.3 An alternative architecture of the ADO.NET.

Figure 3.4 An example code of the opening a connection.

Figure 3.5 An example code for the cleanup of resources.

Figure 3.6 Four constructors of the Parameter class.

Figure 3.7 An example of initializing the property of a Parameter object.

Figure 3.8 Two methods to add Parameter objects.

Figure 3.9 Three popular protocols of the constructor of the Command class....

Figure 3.10 An example of creating a SqlCommand object.

Figure 3.11 An example of code running of ExecuteReader method.

Figure 3.12 A sample of code using the ExecuteScalar method.

Figure 3.13 An example of code using the ExecuteNonQuery method.

Figure 3.14 An example of using the SqlDataAdapter to fill the DataSet.

Figure 3.15 An example code of using the SqlDataReader object.

Figure 3.16 A global representation of the DataSet and other data objects.

Figure 3.17 An example of using the DataSet.

Figure 3.18 An example of adding a DataTable into a DataSet.

Figure 3.19 An example of creating a new table and adding data into the tabl...

Figure 3.20 The mapping relationship between three layers.

Figure 3.21 Entity Framework architecture.

Figure 3.22 An example of the ADO.NET 4.3 Entity Data Model Designer.

Figure 3.23 The new created project EDModel Project.

Figure 3.24 The EDModelForm window.

Figure 3.25 Displayed all available Entity Framework tools.

Figure 3.26 The finished Add New Item Wizard.

Figure 3.27 The Connection properties wizard.

Figure 3.28 The Designer view of the Entity Data Model EDModel.

Figure 3.29 An example of Mapping Details – Faculty entity.

Figure 3.30 The codes for the cmdShow_Click event procedure.

Figure 3.31 The running result of the project EDModel.

Chapter 4

Figure 4.1 A coding example of using LINQ to Object query.

Figure 4.2 A modification of the coding example of using LINQ to Object quer...

Figure 4.3 A coding example of using LINQ to SQL query.

Figure 4.4 An example code for the operator AsEnumerable.

Figure 4.5 An example code for the operator Cast.

Figure 4.6 An example code for the operator Join.

Figure 4.7 An example code for the operator OfType.

Figure 4.8 An example code for the operator OrderBy.

Figure 4.9 An example code for the operator Select.

Figure 4.10 An example code for the operator Where.

Figure 4.11 An example code for the operator ElementAt.

Figure 4.12 An example code for the operator First.

Figure 4.13 An example of code for the operator Last.

Figure 4.14 An example of code for the operator Single.

Figure 4.15 An example of code for the operator ToArray.

Figure 4.16 An example of code for the operator ToList.

Figure 4.17 An example code for the LINQ query.

Figure 4.18 The running process of a LINQ query.

Figure 4.19 A typical query expression of LINQ query.

Figure 4.20 A typical LINQ architecture.

Figure 4.21 The relationship between LINQ to DataSet and ADO.NET 2.0.

Figure 4.22 Relationship between LINQ to Entities, the Entity Framework and ...

Figure 4.23 The codes for the example project NonGenericLINQ.

Figure 4.24 The codes for the example project QueryStringLINQ.

Figure 4.25 The content of the sample text file scores.csv.

Figure 4.26 The codes for the example project SortLinesLINQ.

Figure 4.27 The running result of the project SortLinesLINQ.

Figure 4.28 The codes for the example project QueryContentsLINQ.

Figure 4.29 The codes for the example project QueryReflectionLINQ.

Figure 4.30 The example codes for the query expression syntax.

Figure 4.31 The example codes for the query expression in implicit typing of...

Figure 4.32 The codes for the example project QueryMethodSyntax.

Figure 4.33 The codes for the example project DataSetSingleTableLINQ.

Figure 4.34 The codes for the example project DataSetCrossTableLINQ.

Figure 4.35 The opened Add New Item dialog box.

Figure 4.36 The Add Connection dialog and the Server Explorer window.

Figure 4.37 The codes for the example project TypedDataSetLINQ.

Figure 4.38 The codes for the example project DataRowFieldLINQ.

Figure 4.39 The codes for the example project DataRowSetFieldLINQ.

Figure 4.40 Select the LINQ to SQL Tools.

Figure 4.41 The Add New item dialog.

Figure 4.42 The opened Object Relational Designer.

Figure 4.43 The finished Designer.

Figure 4.44 The codes for the console Main method.

Figure 4.45 The codes for the LINQSelect subroutine.

Figure 4.46 The codes for the LINQInsert() subroutine procedure.

Figure 4.47 The codes for the LINQUpdate() subroutine procedure.

Figure 4.48 The codes for the LINQDelete() subroutine procedure.

Figure 4.49 An example of expression used in LINQ to Entities.

Figure 4.50 An example of executing the query.

Figure 4.51 A simplified structure of LINQ to Entities.

Figure 4.52 The LINQ to XML class hierarchy.

Figure 4.53 A sample XML file created using LINQ to XML.

Figure 4.54 A sample functional construction.

Figure 4.55 A sample query using LINQ to XML.

Figure 4.56 Some sample codes of using LINQ to XML to insert XML.

Figure 4.57 Some sample codes of using LINQ to XML to update XML.

Figure 4.58 Some sample codes of using LINQ to XML to delete XML.

Figure 4.59 A sample XML attributes.

Figure 4.60 A sample code to create an XAttribut.

Figure 4.61 A sample code to get and delete an XAttribut.

Figure 4.62 A sample code to create an XElement.

Figure 4.63 A sample code to perform the query to an XElement.

Figure 4.64 A sample code to perform the query using query expressions with ...

Figure 4.65 A sample code to perform the query using mixing XML.

Figure 4.66 A sample XML.

Figure 4.67 A piece of sample codes to read and update database.

Figure 4.68 A piece of sample codes for lambda expressions.

Figure 4.69 An example of defining class and instance method.

Figure 4.70 An example of calling class and instance method.

Figure 4.71 The running result of the execution of the extension method.

Figure 4.72 Declare the class method

ToUpper()

to extension method.

Figure 4.73 Declare an anonymous type variable.

Figure 4.74 Declare an anonymous type variable using implicitly typed local ...

Figure 4.75 An example of using the object initializer.

Figure 4.76 A typical syntax of query expression.

Figure 4.77 A real example of query expression.

Figure 4.78 A LINQ to Object query.

Chapter 5

Figure 5.1 The LogIn form.

Figure 5.2 The Selection form.

Figure 5.3 The Faculty form.

Figure 5.4 The Course form.

Figure 5.5 The Data components in Toolbox window.

Figure 5.6 The relationship between data components.

Figure 5.7 The Data Sources window.

Figure 5.8 The Data Source Configuration Wizard.

Figure 5.9 Choose a Database Model in the Data Source Configuration Wizard....

Figure 5.10 The Change Data Source wizard.

Figure 5.11 The Add Connection and Change Data Source wizards.

Figure 5.12 Choose Your Database Objects wizard.

Figure 5.13 The added data source.

Figure 5.14 A sample DataSet Designer.

Figure 5.15 The opened Preview Data wizard.

Figure 5.16 An example of the Preview Data for Faculty table.

Figure 5.17 The finished project window.

Figure 5.18 The completed Selection form.

Figure 5.19 The finished Faculty form.

Figure 5.20 The completed Course form.

Figure 5.21 The completed Student form.

Figure 5.22 The DataGridView tool.

Figure 5.23 The entire table view for the Faculty table.

Figure 5.24 The Detail view for specified columns.

Figure 5.25 The running status of the Detail view for each record.

Figure 5.26 The Query Build window.

Figure 5.27 The Choose Methods to Generate wizard.

Figure 5.28 The result of the TableAdapter Query Configuration Wizard.

Figure 5.29 The DataBindings property.

Figure 5.30 The created BindingSource object LogInBindingSource.

Figure 5.31 The codes of the LogIn button event procedure.

Figure 5.32 The running status of the LogIn Form.

Figure 5.33 The warning message.

Figure 5.34 The finished Query Builder.

Figure 5.35 The codes for the cmdPW button event procedure.

Figure 5.36 The running status of the LogIn form.

Figure 5.37 The Selection Form.

Figure 5.38 The coddes for the Selection Form_Load event procedure.

Figure 5.39 The codes for the OK button event procedure.

Figure 5.40 The codes for the Exit button click event procedure.

Figure 5.41 The expansion for Faculty table data binding.

Figure 5.42 An example of the Query Builder.

Figure 5.43 The codes for the FacultyForm_Load event procedure.

Figure 5.44 The codes for the Select button event procedure.

Figure 5.45 The codes for the Back button.

Figure 5.46 The codes for the LINQ to DataSet subroutine.

Figure 5.47 The running status of the Faculty form window.

Figure 5.48 The finished query for the faculty_id.

Figure 5.49 The Query Builder.

Figure 5.50 The expansion of the data source.

Figure 5.51 The codes for the CourseForm_Load event procedure.

Figure 5.52 The codes for the Select button click event procedure.

Figure 5.53 The codes for the LINQ to DataSet subroutine.

Figure 5.54 The running status of the Course form.

Figure 5.55 The relationships between Course ListBox, Course table and TextB...

Figure 5.56 Classes provided by ADO.NET.

Figure 5.57 The declaration of the namespace for the SQL Server Data Provide...

Figure 5.58 The modified LogIn form window.

Figure 5.59 The codes for the database connection.

Figure 5.60 The codes for the TabLogIn button event procedure.

Figure 5.61 The codes for the ReadLogIn button event procedure.

Figure 5.62 The codes for the Cancel button event procedure.

Figure 5.63 The codes for the SelectionForm_Load event procedure.

Figure 5.64 The codes for the OK Click button’s event procedure.

Figure 5.65 The codes for the Exit Click button’s event procedure.

Figure 5.66 The codes for the FacultyForm_Load() event procedure.

Figure 5.67 The modified codes for the Select button event procedure.

Figure 5.68 The codes for the user defined subroutine procedure FillFacultyT...

Figure 5.69 The codes for the user defined subroutine procedure MapFacultyTa...

Figure 5.70 The codes for the subroutine procedure FillFacultyReader.

Figure 5.71 The codes for the subroutine procedure ShowFaculty().

Figure 5.72 Three methods to retrieve images from SQL Server database.

Figure 5.73 The modified codes for the subroutine FillFacultyTable().

Figure 5.74 The modified codes for the subroutine FillFacultyReader().

Figure 5.75 The codes for the CourseForm_Load() event procedure.

Figure 5.76 The modified codes for the Select button event procedure.

Figure 5.77 The codes for two user defined subroutine procedures.

Figure 5.78 The codes for the CourseList_SelectedIndexChanged procedure.

Figure 5.79 The codes for two user defined subroutine procedures.

Figure 5.80 The codes for the subroutine MapCourseTable.

Figure 5.81 The codes for the Back button Click event procedure.

Figure 5.82 The Student Form window.

Figure 5.83 The codes for the Form_Load event procedure.

Figure 5.84 The opened SQL Server Connect wizard.

Figure 5.85 The prototype of a SQL Server stored procedure.

Figure 5.86 A sample SQL Server stored procedure.

Figure 5.87 An example of calling the stored procedure.

Figure 5.88 The first stored procedure – dbo.StudentInfo.

Figure 5.89 The second stored procedure – dbo.StudentCourseInfo.

Figure 5.90 The popup menu and EXECUTE dialog box.

Figure 5.91 The testing result of our first stored procedure.

Figure 5.92 The testing result for our second stored procedure.

Figure 5.93 The codes for the Select button Click event procedure.

Figure 5.94 The codes for the subroutine BuildCommand().

Figure 5.95 The codes for the subroutine FillStudent().

Figure 5.96 The codes for the subroutine FillCourseList().

Figure 5.97 The codes for the subroutine MapStudentTextBox().

Figure 5.98 The running status of the Student form.

Figure 5.99 The new stored procedure – StudentCourseINTO.

Figure 5.100 The running result of the stored procedure.

Figure 5.101 The codes for the Select button event procedure.

Figure 5.102 The running status of calling stored procedure dbo.StudentCours...

Chapter 6

Figure 6.1 The form‐level collection object.

Figure 6.2 The codes for the Insert button event procedure.

Figure 6.3 The codes for the subroutine CreateFacultyCollection.

Figure 6.4 The codes for the subroutine RemoveFacultyCollection.

Figure 6.5 The modified codes for the Form_Load event procedure.

Figure 6.6 The opened Query Builder wizard.

Figure 6.7 The modified codes for the Insert button event procedure.

Figure 6.8 The codes for the txtID TextChanged event procedure.

Figure 6.9 Detailed codes for the user defined function getFacultyImage().

Figure 6.10 The codes for the second data insertion method.

Figure 6.11 The codes for the user defined function InsertFacultyRow.

Figure 6.12 The running status of inserting a new faculty.

Figure 6.13 The confirmation result of the new inserted faculty member.

Figure 6.14 The opened Query Builder wizard.

Figure 6.15 The confirmation wizard.

Figure 6.16 The code modification to the Form_Load event procedure.

Figure 6.17 The code developments for the Insert button’s Click event proced...

Figure 6.18 The codes for the subroutine CleanInsert().

Figure 6.19 The running result of calling the stored procedure.

Figure 6.20 The codes for the user defined subroutine InitFacultyInfo().

Figure 6.21 The codes for the function CheckFacultyInfo().

Figure 6.22 The first piece of codes for the Insert button’s Click event pro...

Figure 6.23 The second piece of codes for the Insert button’s event procedur...

Figure 6.24 The codes for the user‐defined subroutine InsertParameters().

Figure 6.25 The codes for the user‐defined subroutine CleanInsert().

Figure 6.26 The codes for the user defined function getFacultyImage().

Figure 6.27 The new inserted faculty record in the Faculty Form window.

Figure 6.28 The new inserted faculty member Mhamed Jones.

Figure 6.29 The codes for the stored procedure dbo.InsertFacultyCourse.

Figure 6.30 The Run Stored Procedure wizard.

Figure 6.31 The running result of the stored procedure.

Figure 6.32 The codes for user defined subroutine and function.

Figure 6.33 The first coding part for the Insert button’s event procedure.

Figure 6.34 The modifications to the Insert button’s Click event procedure....

Figure 6.35 The codes for the user defined subroutine InsertParameters().

Figure 6.36 The running status of the Course Form window.

Figure 6.37 The data validation process.

Figure 6.38 The codes to call the SQL Server stored procedure.

Chapter 7

Figure 7.1 The Query Builder for the Update query.

Figure 7.2 The Query Builder for the Delete query.

Figure 7.3 The modified codes for the Form_Load event procedure.

Figure 7.4 The codes for the Update command button’s Click event procedure....

Figure 7.5 The codes for the second data updating method.

Figure 7.6 The codes for the user‐defined function UPFacultyRow().

Figure 7.7 The codes for the Delete button’s Click event procedure.

Figure 7.8 The codes for the second data deleting method.

Figure 7.9 The running status of the Updated Faculty Form window.

Figure 7.10 The updated faculty record.

Figure 7.11 The relationships among tables.

Figure 7.12 The codes for the data updating operation.

Figure 7.13 The codes for the data‐deleting query.

Figure 7.14 The updated faculty information window.

Figure 7.15 Modified codes for the cmdSelect button’s Click event procedure....

Figure 7.16 Modified codes for the subroutine ShowFaculty().

Figure 7.17 The codes for the Update button’s event procedure.

Figure 7.18 The codes for the user defined procedure UpdateParameters().

Figure 7.19 The modified codes to call the stored procedure.

Figure 7.20 The created stored procedure dbo.UpdateFacultySP.

Figure 7.21 The finished information wizard.

Figure 7.22 The updated Faculty table.

Figure 7.23 The created data deleting stored procedure.

Figure 7.24 The recovered course CSE‐438.

Figure 7.25 Initialization codes for the Form_Load event procedure of the St...

Figure 7.26 The codes for the Select button Click event procedure.

Figure 7.27 The codes for the Insert button Click event procedure.

Figure 7.28 The retrieved new inserted student record.

Figure 7.29 Three new courses are added into the CourseList box.

Figure 7.30 The codes for the Update button Click event procedure.

Figure 7.31 The codes for the Delete button Click event procedure.

Chapter 8

Figure 8.1 The .NET Framework model.

Figure 8.2 The structure of an ASP.NET Web application.

Figure 8.3 ASP.NET Web application file structure.

Figure 8.4 The opened Template wizard.

Figure 8.5 The finished LogIn Web form.

Figure 8.6 The codes for the Page_Load event procedure.

Figure 8.7 The codes for the LogIn button’s Click event procedure.

Figure 8.8 The codes for the Cancel button’s event procedure.

Figure 8.9 Adding the data validation –RequiredFieldValidator.

Figure 8.10 The finished Selection page.

Figure 8.11 The codes for the Page_Load event procedure of the Selection pag...

Figure 8.12 The codes for the Select button’s event procedure.

Figure 8.13 The codes for the Exit button’s Click event procedure.

Figure 8.14 The running status of the second page – Selection page.

Figure 8.15 The finished Faculty page.

Figure 8.16 The codes for the Page_Load event procedure.

Figure 8.17 The codes for the Select button’s Click event procedure.

Figure 8.18 The codes for the subroutine FillFacultyReader.

Figure 8.19 The codes for the subroutine MapFacultyTable.

Figure 8.20 The codes for the Back button’s Click event procedure.

Figure 8.21 The running status of the Faculty page.

Figure 8.22 The finished Course Web page.

Figure 8.23 The codes for the Page_Load event procedure.

Figure 8.24 The codes for the Select button’s Click event procedure.

Figure 8.25 The codes for the subroutine FillCourseReader().

Figure 8.26 The codes for the SelectedIndexChanged event procedure.

Figure 8.27 The codes for the subroutine FillCourseReaderTextBox().

Figure 8.28 The codes for the subroutine MapCourseTable().

Figure 8.29 The running status of the Course page.

Figure 8.30 The detailed course information.

Figure 8.31 The codes for the Insert button’s Click event procedure.

Figure 8.32 The codes for the subroutine InsertParameters().

Figure 8.33 The codes for the subroutine GetFacultyImage().

Figure 8.34 The codes for the subroutine CleanInsert().

Figure 8.35 The completed codes for the Insert button’s Click event procedur...

Figure 8.36 The codes for the function CheckFaculty().

Figure 8.37 The running status of the Faculty page.

Figure 8.38 The data validation process.

Figure 8.39 The modified codes for the Select button’s event procedure.

Figure 8.40 The codes for the Update button’s click event procedure.

Figure 8.41 The codes for the subroutine UpdateParameters().

Figure 8.42 The data updating process.

Figure 8.43 The relationships between five tables.

Figure 8.44 The Foreign Key Relationship wizard.

Figure 8.45 The stored procedure dbo.DeleteFaculty.

Figure 8.46 The finished Run Stored Procedure wizard.

Figure 8.47 The running result of the stored procedure.

Figure 8.48 The codes for the Delete button’s Click event procedure.

Figure 8.49 The codes for the subroutine CleanFaculty().

Figure 8.50 Initialization codes for the Faculty Web page.

Figure 8.51 The codes for the Exit button Click event procedure.

Figure 8.52 The codes for the Select button Click event procedure.

Figure 8.53 The codes for the Insert button Click event procedure.

Figure 8.54 The codes for the function CheckFaculty().

Figure 8.55 The codes for the subroutine GetFacultyImage().

Figure 8.56 The codes for the subroutine MapFacultyTable.

Figure 8.57 The codes for the Update button Click event procedure.

Figure 8.58 The codes for the Delete button Click event procedure.

Figure 8.59 The testing status of the data insertion action.

Figure 8.60 The codes for the Page_Load() event procedure.

Chapter 9

Figure 9.1 A typical process of a Web service.

Figure 9.2 The Service interface and contract.

Figure 9.3 The codes in the client side to call the operation GetData() in t...

Figure 9.4 Create a new WCF Web Service project.

Figure 9.5 New created items for a WCF Web service project.

Figure 9.6 The modified Web service project.

Figure 9.7 The default codes for the code‐behind page WebServiceSQLSelect.vb...

Figure 9.8 The running status of the default Web service project.

Figure 9.9 The test method page.

Figure 9.10 The running status of the default method.

Figure 9.11 The modified main service page.

Figure 9.12 The running status of the modified Web service project.

Figure 9.13 The class member data.

Figure 9.14 The member data for the class SQLSelectResult.

Figure 9.15 The modified codes to test the connection string.

Figure 9.16 The modified Web method – GetSQLSelect().

Figure 9.17 The modified codes for the Web method.

Figure 9.18 The codes for the subroutine FillFacultyReader().

Figure 9.19 The codes for the subroutine ReportError().

Figure 9.20 The running status of the Web service.

Figure 9.21 The running status of our Web method.

Figure 9.22 The running result of our Web service project.

Figure 9.23 The stored procedure dbo.WebSelectFacultySP.

Figure 9.24 The running result of the stored procedure.

Figure 9.25 The modified Web method – GetSQLSelectSP().

Figure 9.26 The modified Web method – GetSQLSelectDataSet().

Figure 9.27 Three Web methods in built‐in Web interface window.

Figure 9.28 The running result of the Web method GetSQLSelectDataSet().

Figure 9.29 The Add Web Reference wizard.

Figure 9.30 The codes for the Form_Load event procedure.

Figure 9.31 The codes for the Select button click event procedure.

Figure 9.32 The codes for two user defined subroutines.

Figure 9.33 The codes for the subroutine FillFacultyDataSet().

Figure 9.34 The running status of our Web service project WebServiceSQLSelec...

Figure 9.35 The running status of our client project.

Figure 9.36 Add a Web reference.

Figure 9.37 The modified Faculty.aspx page.

Figure 9.38 The modified Page_Load event procedure.

Figure 9.39 The modified codes for the Select button’s click event procedure...

Figure 9.40 The modified codes for the subroutine ProcessObject().

Figure 9.41 The modified codes for the subroutine FillFacultyObject().

Figure 9.42 The modified codes for the subroutine FillFacultyDataSet().

Figure 9.43 The modified codes for the Back button event procedure.

Figure 9.44 The running status of our Web‐based client project.

Figure 9.45 The completed Add Website wizard.

Figure 9.46 The Customer Profile setup wizard.

Figure 9.47 The Web site Publishing result.

Figure 9.48 Modifications to the first Web method.

Figure 9.49 Detailed codes for the user defined function and subroutine.

Figure 9.50 The running status of the built‐in Web interface.

Figure 9.51 The input parameter interface.

Figure 9.52 The running result of the first Web method.

Figure 9.53 The codes for our second Web method GetSQLInsert().

Figure 9.54 The codes for the subroutine FillCourseReader().

Figure 9.55 The running status of our Web service project.

Figure 9.56 The input parameter wizard for the Web method GetSQLInsert().

Figure 9.57 The running result of our Web method GetSQLInsert().

Figure 9.58 The codes for the Web method SQLInsertDataSet().

Figure 9.59 The finished input parameter wizard.

Figure 9.60 The running result of the third Web method.

Figure 9.61 The codes for the stored procedure WebSelectCourseSP().

Figure 9.62 The running result of the stored procedure WebSelectCourseSP()....

Figure 9.63 The codes for the Web method GetSQLInsertCourse().

Figure 9.64 The codes for the subroutine FillCourseDetail().

Figure 9.65 The running result of our Web method GetSQLInsertCourse().

Figure 9.66 The finished Add Web Reference wizard.

Figure 9.67 The finished graphic user interface.

Figure 9.68 The codes of the Form_Load and Back button event procedures.

Figure 9.69 The codes for the Insert button Click event procedure.

Figure 9.70 The codes for the user defined function CheckCourse().

Figure 9.71 The codes for the Select button Click event procedure.

Figure 9.72 The codes for the subroutines ProcessObject() and FillCourseList...

Figure 9.73 The codes for the subroutine FillCourseDataSet().

Figure 9.74 The running result of the data validation.

Figure 9.75 The codes for the SelectedIndexChanged event procedure.

Figure 9.76 The running status of getting the detailed course information.

Figure 9.77 The finished Add Web Reference wizard.

Figure 9.78 The modified Course page window.

Figure 9.79 The modified Page_Load event procedure.

Figure 9.80 The codes for the Insert button event procedure.

Figure 9.81 The detailed codes for the user defined function CheckCourse()....

Figure 9.82 The codes for the Select button event procedure.

Figure 9.83 The codes for subroutines ProcessObject() and FillCourseListBox(...

Figure 9.84 The codes for the subroutine FillCourseDataSet().

Figure 9.85 The modified codes for the SelectedIndexChanged event procedure....

Figure 9.86 The codes for the subroutine FillCourseDetail().

Figure 9.87 The running status of inserting new course records.

Figure 9.88 The running status of the data validation process.

Figure 9.89 The running status of getting the detailed course information.

Figure 9.90 The modified namespace.

Figure 9.91 The member data for the class SQLResult.

Figure 9.92 The codes for the Web method SQLUpdateSP().

Figure 9.93 The codes for the Web method SQLDeleteSP().

Figure 9.94 Detailed codes for the stored procedure WebUpdateStudentSP().

Figure 9.95 The input parameters to stored procedure WebUpdateStudentSP().

Figure 9.96 The running result of the stored procedure WebUpdateStudentSP()....

Figure 9.97 The codes for the stored procedure WebDeleteCourseSP().

Figure 9.98 The Execute Stored Procedure wizard.

Figure 9.99 The modified Student Form window.

Figure 9.100 The opened Add Web Reference wizard.

Figure 9.101 Detailed codes for the Update button’s click event procedure.

Figure 9.102 The codes for the Delete button’s click event procedure.

Figure 9.103 The running status of the student updating process.

Figure 9.104 The finished Add Web Reference wizard.

Figure 9.105 The codes for the Update button click event procedure.

Figure 9.106 The codes for the Delete button click event procedure.

Figure 9.107 Running result of updating a student record.

Appendix A

Figure A.1 The opened download page.

Figure A.2 The Installation Option wizard.

Figure A.3 The SQL Server media download target location page.

Figure A.4 The SQL Server Installation Center wizard.

Figure A.5 The Setup wizard.

Figure A.6 The intermediate checking results page.

Figure A.7 The Database Engine Configuration page.

Figure A.8 The installation process.

Figure A.9 The installation is completed.

Figure A.10 Opened Web page to install SSMS 18.0.

Figure A.11 The installation processing page.

Figure A.12 Check the port number used by the SQL Server.

Figure A.13 The opened SQL Server Configuration Manager wizard.

Figure A.14 The opened New Inbound Rule Wizard.

Figure A.15 The opened Protocol and Ports wizard.

Figure A.16 The opened Name wizard.

Figure A.17 The completed Inbound Rules addition.

Figure A.18 The opened System wizard on the Control Panel.

Figure A.19 The started SQL Server 2017 Express.

Figure A.20 The connected SQL Server 2017 Express database.

Appendix B

Figure B.1 The opened site for WindowsUI component.

Figure B.2 Select WinForms Controls to install the WindowsUI component.

Figure B.3 The downloading and installation process starts.

Appendix C

Figure C.1 FrontPage Server Extensions installation.

Figure C.2 FrontPage Server Extensions installation additional features.

Figure C.3 FrontPage Server Extensions install button.

Figure C.4 FrontPage Server Extensions installation in progress.

Figure C.5 FrontPage Server Extensions installation complete.

Guide

Cover

Table of Contents

Begin Reading

Pages

ii

iii

v

xix

xxi

xx

xxiii

xxiv

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

655

657

658

659

660

661

662

663

664

IEEE Press445 Hoes LanePiscataway, NJ 08854

IEEE Press Editorial BoardEkram Hossain, Editor in Chief

Jón Atli Benediktsson

David Alan Grier

Elya B. Joffe

Xiaoou Li

Peter Lian

Andreas Molisch

Saeid Nahavandi

Jeffrey Reed

Diomidis Spinellis

Sarah Spurgeon

Ahmet Murat Tekalp

SQL Server Database Programming with Visual Basic.NET

Concepts, Designs and Implementations

Ying Bai

Department of Computer Science and EngineeringJohnson C. Smith UniversityCharlotte, North Carolina USA

 

 

 

 

Copyright © 2020 by The Institute of Electrical and Electronics Engineers, Inc. All rights reserved.

Published by John Wiley & Sons, Inc., Hoboken, New Jersey.Published simultaneously in Canada.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per‐copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750‐8400, fax (978) 750‐4470, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748‐6011, fax (201) 748‐6008, or online at http://www.wiley.com/go/permission.

Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation. You should consult with a professional where appropriate. Neither the publisher nor author shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages.

For general information on our other products and services or for technical support, please contact our Customer Care Department within the United States at (800) 762‐2974, outside the United States at (317) 572‐3993 or fax (317) 572‐4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic formats. For more information about Wiley products, visit our web site at www.wiley.com.

Library of Congress Cataloging‐in‐Publication Data

Names: Bai, Ying, 1956– author.Title: SQL server database programming with visual basic.net : concepts, designs and implementations / Ying Bai, Department of Computer Science and Engineering, Johnson C. Smith University Charlotte, North Carolina.Description: First edition. | Hoboken, NJ : John Wiley & Sons, Inc., [2020] | Series: Wiley IEEE | Includes bibliographical references and index.Identifiers: LCCN 2020016203 (print) | LCCN 2020016204 (ebook) | ISBN 9781119608509 (paperback) | ISBN 9781119608516 (adobe pdf) | ISBN 9781119608608 (epub)Subjects: LCSH: SQL server. | Client/server computing. | Database management. | Visual Basic (Computer program language)Classification: LCC QA76.9.C55 S7525 2020 (print) | LCC QA76.9.C55 (ebook) | DDC 005.75/85–dc23LC record available at https://lccn.loc.gov/2020016203LC ebook record available at https://lccn.loc.gov/2020016204

Cover Design: WileyCover Image: © Hoxton/Martin Barraud/Getty Images

This book is dedicated to my wife, Yan Wangand my daughter, Susan (Xue) Bai.

About the Author

Dr. YING BAI is a Professor in the Department of Computer Science and Engineering at Johnson C. Smith University. His special interests include: artificial intelligent controls, soft‐computing, mix‐language programming, fuzzy logic controls, robotic controls, robots calibrations, and database programming.

His industry experience includes positions as software and senior software engineer at companies such as Motorola MMS, Schlumberger ATE Technology, Immix TeleCom, and Lam Research.

Since 2003, Dr. Bai has published fifteen (15) books with publishers such as Prentice Hall, CRC Press LLC, Springer, Cambridge University Press, and Wiley IEEE Press. Two of them were translated into other languages. The Russian translation of his first book titled Applications Interface Programming Using Multiple Languages was published by Prentice Hall in 2005. The Chinese translation of his eigth book titled Practical Database Programming with Visual C#.NET was published by Tsinghua University Press in China in 2011. Most books are about software programming, serial port programming, fuzzy logic controls in industrial applications, microcontroller controls and programming, as well as classical and modern controls on microcontrollers.

During recent years, Dr. Bai has also published about sixty (60) academic research papers in IEEE Trans. Journals and International conferences.

Preface

Databases have become an integral part of our modern day life. We are an information‐driven society. Database technology has a direct impact on our daily lives. Decisions are routinely made by organizations based on the information collected and stored in the databases. A record company may decide to market certain albums in selected regions based on the music preference of teenagers. Grocery stores display more popular items at eye level and reorders are based on the inventories taken at regular intervals. Other examples include patients’ records in hospitals, customers’ account information in banks, book orders by the libraries, club memberships, auto part orders, and winter cloth stock by department stores and many others.

In addition to database management systems, in order to effectively apply and implement databases in real industrial or commercial systems, a good Graphic User Interface (GUI) is needed to allow users to access and manipulate their records or data in databases. Visual Basic.NET is an ideal candidate to be selected to provide this GUI functionality. Unlike other programming languages, Visual Basic.NET is a kind of language that has advantages such as being easy‐to‐learn and easy‐to‐be‐understood with little learning curves. Beginning of Visual Studio.NET 2005, Microsoft integrated a few programming languages such as Visual C++, Visual Basic, C# and Visual J# into a dynamic model called .NET Framework that makes Internet and Web programming easy and simple, and any language integrated in this model can be used to develop professional and efficient Web applications that can be used to communicate with others via Internet. ADO.NET and ASP.NET are two important sub‐models of .NET Framework. The former provides all components, including the Data Providers, DataSet and DataTable, to access and manipulate data against different databases. The latter provides support to develop Web applications and Web services in ASP.NET environment to allow users to exchange information between clients and servers easily and conveniently.

This book is mainly designed for college students and software programmers who want to develop practical and commercial database programming with Visual Basic.NET and relational database such as Microsoft SQL Server 2017. The book provides a detailed description about the practical considerations and applications in database programming via Visual Basic.NET 2017 with authentic examples and detailed explanations. More important, a new writing style is developed and implemented in this book, combined with real examples, to provide readers with a clear picture as to how to handle the database programming issues in Visual Basic.NET 2017 environment.

The outstanding features of this book include, but are not limited to:

A novel writing style is adopted to try to attract students’ or beginning programmers’ interest in learning and developing practical database programs, and to avoid the headache caused by using huge blocks of codes in the traditional database programming books.

Updated database programming tools and components are covered in the book, such as .NET Framework 4.6, LINQ, ADO.NET 4.5 and ASP.NET 4.6, to enable readers to easily and quickly learn and master advanced techniques in database programming and develop professional and practical database applications.

A real completed sample database CSE_DEPT with Microsoft SQL Server 2017 is provided and used for entire book. Step by step, a detailed illustration and description about how to design and build a practical relational database are provided.

Covers both fundamental and advanced database‐programming techniques to convenience both beginning students and experienced programmers.

Various actual data providers are discussed and implemented in the sample projects, such as the SQL Server and OleDb data providers. Instead of using the OleDb to access the SQL Server, the real SQL Server data provider is utilized to connect to the Visual Basic.NET 2017 directly to perform data operations.

All projects can be run in Microsoft Visual Studio.NET 2019 even they are developed and built with Visual Studio.NET 2017.

Good textbook for college students, good reference book for programmers, software engineers, and academic researchers.

I sincerely hope that this book can provide useful and practical help, and can guide all readers or users who adopted this book to develop and build professional and practical database applications.

Ying Bai

Acknowledgment

The first and most special thanks to my wife, Yan Wang, and I could not have finished this book without her sincere encouragement and support.

My special thanks to Dr. Satish Bhalla who is the chapter contributor for this book. Dr. Bhalla is a specialist in database programming and management, especially in SQL Server, Oracle, and DB2. Dr. Bhalla spent a lot of time preparing materials for Chapter 2 and he deserves thanks for this.

Many thanks to the Editor, Mary Hatcher, who made this book available to the public. This book would not have reached the market without her deep perspective and hard work. The same thanks are extended to the editorial team of this book. Without their contributions, it would be impossible for this book to be published.

These thanks should also be extended to the following book reviewers for their precious opinions to this book:

Dr. Jiang (Linda) Xie, Professor, Department of Electrical and Computer Engineering, University of North Carolina at Charlotte.

Dr. Dali Wang, Professor, Department of Physics and Computer Science, Christopher Newport University.

Last but not least, thanks should be forwarded to all people who have supported me to finish this book.

About the Companion Website

This book is accompanied by a companion website:

www.wiley.com/go/bai/sql

The companion website consists of a student website and an instructor website, and contains:

Student Website

DB Projects

Images

Sample Database

VB Forms

Instructor Website

DB Projects

HW Solutions

Images

Sample Database

Teaching Power Point Slides

Chapter 1Introduction