Download ebooks file (Ebook) SQL Server Database Programming With Visual Basic.NET: Concepts, Designs and Implementations by Ying Bai ISBN 9781119608509, 1119608503 all chapters
Download ebooks file (Ebook) SQL Server Database Programming With Visual Basic.NET: Concepts, Designs and Implementations by Ying Bai ISBN 9781119608509, 1119608503 all chapters
com
OR CLICK HERE
DOWLOAD EBOOK
(Ebook) Oracle Database Programming with Visual Basic.NET: Concepts, Designs, and
Implementations by Ying Bai ISBN 9781119734390, 1119734398
https://ebooknice.com/product/oracle-database-programming-with-visual-basic-net-
concepts-designs-and-implementations-35134992
ebooknice.com
(Ebook) Practical Database Programming with Visual Basic.NET, 2nd Edition by Ying
Bai ISBN 9781118162057, 1118162056
https://ebooknice.com/product/practical-database-programming-with-visual-basic-
net-2nd-edition-5473240
ebooknice.com
(Ebook) Practical Database Programming with Visual Basic.NET by Ying Bai ISBN
9780521712354, 9780521885188, 0521712351, 0521885183
https://ebooknice.com/product/practical-database-programming-with-visual-basic-
net-1367072
ebooknice.com
(Ebook) Practical Database Programming with Visual Basic.NET, Second Edition by Ying
Bai(auth.) ISBN 9781118162057, 9781118249833, 1118162056, 1118249836
https://ebooknice.com/product/practical-database-programming-with-visual-basic-
net-second-edition-4310366
ebooknice.com
(Ebook) Practical Database Programming with Java by Ying Bai ISBN 9780470889404,
0470889403
https://ebooknice.com/product/practical-database-programming-with-java-2501314
ebooknice.com
(Ebook) Practical Database Programming with Java by Ying Bai ISBN 9780470889404,
9781118104651, 9781118104668, 9781118104699, 0470889403, 111810465X, 1118104668,
1118104692
https://ebooknice.com/product/practical-database-programming-with-java-47700340
ebooknice.com
(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James ISBN
9781459699816, 9781743365571, 9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374
ebooknice.com
(Ebook) Programming Microsoft SQL Server 2000 with Microsoft Visual Basic .NET by
Rick Dobson, Paul Cornell ISBN 9780735615359, 0735615357
https://ebooknice.com/product/programming-microsoft-sql-server-2000-with-
microsoft-visual-basic-net-975148
ebooknice.com
(Ebook) SQL Server Execution Plans. For SQL Server 2008 through to 2017 and Azure
SQL Database by Grant Fritchey ISBN 9781910035221, 191003522X
https://ebooknice.com/product/sql-server-execution-plans-for-sql-
server-2008-through-to-2017-and-azure-sql-database-11063662
ebooknice.com
SQL Server Database Programming
with Visual Basic.NET
IEEE Press
445 Hoes Lane
Piscataway, NJ 08854
Ying Bai
Department of Computer Science and Engineering
Johnson C. Smith University
Charlotte, North Carolina USA
Copyright © 2020 by The Institute of Electrical and Electronics Engineers, Inc. All rights reserved.
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.
10 9 8 7 6 5 4 3 2 1
This book is dedicated to my wife, Yan Wang
and my daughter, Susan (Xue) Bai.
vii
Contents
Chapter 1 Introduction 1
1.1 Outstanding Features About This Book 2
1.2 This Book Is For 2
1.3 What This Book Covers 2
1.4 How This Book Is Organized and How to Use This Book 5
1.5 How to Use Source Codes and Sample Database 6
1.6 Instructors and Customers Supports 8
7.5.2 Create the Codes to Update and Delete Data from the Course Table 405
7.5.2.1 Develop Two Stored Procedures in the SQL Server Database 407
7.5.2.2 Call the Stored Procedures to Perform the Data Updating and Deleting 409
7.5.3 Update and Delete Data against Databases Using the LINQ to SQL Query 412
7.5.3.1 Update and Delete Data Using LINQ to SQL Query for Student Table 413
7.5.3.2 Create a New Object of the DataContext Class for Student Form 414
7.5.3.3 Develop the Codes for the Select Button Click Event Procedure 415
7.5.3.4 Develop the Codes for the Insert Button Click Event Procedure 416
7.5.3.5 Develop the Codes for the Update Button Click Event Procedure 419
7.5.3.6 Develop the Codes for the Delete Button Click Event Procedure 419
7.5.3.7 Run the Project to Test Data Updating and Deleting Actions for Student Table 421
7.6 Chapter Summary 423
Homework 423
9.3.8 Develop the Stored Procedure to Perform the Data Query 533
9.3.8.1 Develop the Stored Procedure WebSelectFacultySP 533
9.3.8.2 Add Another Web Method to Call the Stored Procedure 534
9.3.9 Use DataSet as the Returning Object for the Web Method 536
9.3.10 Build Windows-based Web Service Clients to Consume the Web Services 538
9.3.10.1 Create a Web Service Proxy Class 539
9.3.10.2 Develop the Graphic User Interface for the Windows-based Client Project 541
9.3.10.3 Develop the Code to Consume the Web Service 541
9.3.11 Build Web-based Web Service Clients to Consume the Web Service 548
9.3.11.1 Create a New Web Site Project and Add an Existing Web Page 548
9.3.11.2 Add a Web Service Reference and Modify the Web Form Window 549
9.3.11.3 Modify the Designer and Codes for the Related Event Procedures 550
9.3.12 Deploy the Completed Web Service to Production Servers 555
9.3.12.1 Publish the Desired Web Service 557
9.4 Build ASP.NET Web Service Project to Insert Data Into SQL Server Database 559
9.4.1 Create a New Web Service Project WebServiceSQLInsert 559
9.4.2 Develop Four Web Service Methods 560
9.4.2.1 Develop Codes for the First Web Method SetSQLInsertSP 561
9.4.2.2 Develop Codes for User Defined Functions and Subroutine Procedures 563
9.4.2.3 Develop the Second Web Method GetSQLInsert 565
9.4.2.4 Develop the Third Web Method SQLInsertDataSet 568
9.4.2.5 Develop the Fourth Web Method GetSQLInsertCourse 572
9.4.3 Build Windows-based Web Service Clients to Consume the Web Services 578
9.4.3.1 Create a Windows-Based Consume Project and a Web Service Proxy Class 578
9.4.3.2 Develop the Graphic User Interface for the Client Project 579
9.4.3.3 Develop the Code to Consume the Web Service 581
9.4.4 Build Web-based Web Service Clients to Consume the Web Services 594
9.4.4.1 Create a New Web Site Project and Add an Existing Web Page 594
9.4.4.2 Add a Web Service Reference and Modify the Web Form Window 595
9.4.4.3 Modify the Codes for the Related Event Procedures 596
9.5 Build ASP.NET Web Service to Update and Delete Data for SQL Server Database 606
9.5.1 Modify the Default Namespace and Add Database Connection String 607
9.5.2 Create Our Customer-Built Base and Returned Classes 608
9.5.3 Create a Web Method to Call Stored Procedure to Update Student Records 609
9.5.4 Create a Web Method to Call Stored Procedure to Delete Student Records 611
9.5.5 Develop Two Stored Procedures WebUpdateStudentSP and WebDeleteStudentSP 613
9.5.5.1 Develop the Stored Procedure WebUpdateStudentSP 613
9.5.5.2 Develop the Stored Procedure WebDeleteStudentSP 616
9.6 Build Windows-Based Web Service Clients to Consume the Web Services 618
9.6.1 Modify the Student Form Window 618
9.6.2 Add a New Web Reference to Our Client Project 619
9.6.3 Build the Codes to the Update Button Click Event Procedure 620
9.6.4 Build the Codes to the Delete Button Click Event Procedure 621
Contents xvii
9.7 uild Web-Based Web Service Clients to Consume the Web Services 624
B
9.7.1 Create a New Web Site Application Project and Add an Existing Web Page 625
9.7.2 Add a Web Service Reference and Modify the Web Form Window 625
9.7.3 Modify the Codes Inside the Back Button Click Event Procedure 626
9.7.4 Add the Codes to the Update Button Click Event Procedure 626
9.7.5 Develop Codes for the Delete Button Click Event Procedure 628
9.8 Chapter Summary 631
Homework 632
Appendix A: Install and Configure SQL Server 2017 Express Database 637
Appendix B: Download and Install DevExpress .NET UI Controls 649
Appendix C: Download & Install FrontPage Server Extension for Windows 10 651
Appendix D: How to Use Sample Database 655
Index 657
xix
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 pro-
gramming, 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.
xxi
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 organiza-
tions 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 inter-
vals. 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 lan-
guages 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 serv-
ers 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.
xxii Preface
The outstanding features of this book include, but are not limited to:
1) A novel writing style is adopted to try to attract students’ or beginning programmers’ interest in learn-
ing and developing practical database programs, and to avoid the headache caused by using huge
blocks of codes in the traditional database programming books.
2) 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.
3) 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.
4) Covers both fundamental and advanced database-programming techniques to convenience both
beginning students and experienced programmers.
5) 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.
6) All projects can be run in Microsoft Visual Studio.NET 2019 even they are developed and built with
Visual Studio.NET 2017.
7) 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
xxiii
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 spe-
cialist 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.
xxiv
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
Chapter 1
Introduction
For many years during my teaching database programming and Visual Basic.NET programming courses
in my college, I found that it is too difficult to find a good textbook for this topic so that I had to combine
a few different professional books together as references to teach these courses. Most of those books are
specially designed for programmers or software engineers, which cover a lot of programming strategies
and huge blocks of codes, which is a terrible headache to the college students or beginning programmers
who are new to the Visual Basic.NET and database programming. I have to prepare my class presenta-
tions and figure out all homeworks and exercises for my students. I dreamed that one day I could find a
good textbook that is suitable for college students or beginning programmers and help them to learn and
master the database programming with Visual Basic.NET easily and conveniently. Finally, I decided that
I needed to do something for this dream myself after a long time of waiting.
Another reason for me to have this idea is the job market. As you know, most industrial and commercial
companies in the US belong to database applications businesses such as manufacturers, banks, hospitals,
and retailers. The majority of them need professional people to develop and build database-related applica-
tions, but not database management and design systems. To enable our students to become good candidates
for those companies, we need to create a book like this one.
Unlike most database programming books in the current market, which discuss and present the data-
base programming techniques with huge blocks of programming codes from the first page to the last
page, this book tries to use a new writing style to show readers, especially college students, how to
develop professional and practical database programs in Visual Basic.NET 2017 by using Visual Studio.
NET Design Tools and Wizards related to ADO.NET 4.5, and to apply codes that are auto-generated by
various Wizards. By using this new style, the headache caused by using those huge blocks of program-
ming codes can be removed, instead, a simple and easy way to create database programs using the Design
Tools can be taken to attract students’ learning interest, and furthermore to enable students to build
professional and practical database programming in more efficient and interesting ways.
There are so many different database-programming books available on the market, but rarely can you
find a book like this one, which implemented a novel writing style to attract the students’ learning inter-
ests in this topic. To meet the needs of some experienced or advanced students or software engineers, the
book contains two programming methods: the interesting and easy-to-learn fundamental database pro-
gramming method – Visual Studio.NET Design Tools and Wizards, and advanced database programming
SQL Server Database Programming with Visual Basic.NET: Concepts, Designs and Implementations, First Edition. Ying Bai.
© 2020 The Institute of Electrical and Electronics Engineers, Inc. Published 2020 by John Wiley & Sons, Inc.
Companion website: www.wiley.com/go/bai/sql
2 Chapter 1 Introduction
method – runtime object method. In the second method, all database-related objects are created and
applied during or when your project is running by utilizing quite a few blocks of codes.
1) All programming projects can be run in Microsoft Visual Studio.NET 2019 even if all of them are
developed and built in Visual Studio.NET 2017.
2) A novel writing style is adopted to try to attract students’ or beginning programmers’ interests 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.
3) 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.7, to enable readers to easily and quickly learn
and master advanced techniques in database programming and develop professional and practical
database applications.
4) A real completed sample database CSE_DEPT with Microsoft SQL Server 2018 database engine is
provided and used for the entire book. Step by step, a detailed illustration and description about how
to design and build a practical relational database are provided.
5) both fundamental and advanced database-programming techniques are covered to convenience both
beginning students and experienced programmers.
6) Various actual data providers are discussed and implemented in the sample projects, such as OleDb,
ODBC and SQL Server 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.
7) The book provides homework and teaching materials, and these allow instructors to organize and pre-
pare their courses easily and rapidly, and enable students to understand what they learned better by
doing something themselves.
8) Good textbook for college students, good reference book for programmers, software engineers, and
academic researchers.
This book is designed for college students and software programmers who want to develop practical and
commercial database programming with Visual Basic.NET and relational databases such as Microsoft
SQL Server 2018. Fundamental knowledge and understanding on Visual Basic.NET and Visual Studio.
NET IDE is assumed.
Nine chapters are included in this book. The contents of each chapter can be summarized as below:
●● Chapter 1 provides an introduction and summarization to the whole book.
1.3 What This Book Cover 3
●● Chapter 2 provides a detailed discussion and analysis of the structure and components about rela-
tional databases. Some key technologies in developing and designing database are also given and
discussed in this part. The procedure and components used to develop a practical relational database
with SQL Server 2018 is analyzed in detailed with some real data tables in our sample database
CSE_DEPT.
●● Chapter 3 provides an introduction to the ADO.NET, which includes the architectures, organizations
and components of the ADO.NET. Detailed discussions and descriptions are provided in this chapter
to give readers both fundamental and practical ideas and pictures in how to use components in ADO.
NET to develop professional data-driven applications. Two ADO.NET architectures are discussed to
enable users to follow the directions to design and build their preferred projects based on the different
organizations of the ADO.NET. Four popular data provides, such as OleDb, ODBC, SQL Server and
Oracle, are discussed in detail. The basic ideas and implementation examples of DataTable and DataSet
are also analyzed and described with some real coding examples.
●● Chapter 4 provides a detailed discussion and analysis about the Language-Integrated Query (LINQ),
which includes LINQ to Objects, LINQ to DataSet, LINQ to SQL, LINQ to Entities, and LINQ to XML.
An introduction to LINQ general programming guide is provided at the first part in this chapter. Some
popular interfaces widely used in LINQ, such as IEnumerable, IEnumerable(Of T), IQueryable and
IQueryable(Of T), and Standard Query Operators (SQO) including the deferred and non-deferred
SQO, are discussed in that part. An introduction to LINQ Query is given in the second section in this
chapter. Following this introduction, a detailed discussion and analysis about the LINQ queries that is
implemented for different data sources is provided in detail.
●● Starting from Chapter 5, the real database programming techniques with Visual Basic.NET such as
data selection queries are provided and discussed. Two parts are covered in this chapter: Part I
contains the detailed descriptions in how to develop professional data-driven applications with the
help of the Visual Studio.NET design tools and wizards with some real projects, and this part con-
tains a lot of hiding codes that are created by Visual Basic.NET automatically when using those
design tools and wizards. Therefore, the coding for this part is very simple and easy. Part II covers
an advanced technique, the runtime object method, in developing and building professional data-
driven applications. Detailed discussions and descriptions about how to build professional and
practical database applications using this runtime method are provided combined with four real
projects.
●● Chapter 6 provides detailed discussions and analyses about three popular data insertion methods with
Microsoft SQL Server 2018 database:
1) Using TableAdapter’s DBDirect methods TableAdapter.Insert() method
2) Using the TableAdapter’s Update() method to insert new records that have already been added into
the DataTable in the DataSet
3) Using the Command object’s ExecuteNonQuery() method.
This chapter is also divided into two parts: Methods 1 and 2 are related to Visual Studio.NET design
tools and wizards and therefore are covered in Part I. The third method is related to runtime object and
therefore it is covered in Part II. Three real projects are used to illustrate how to perform the data inser-
tion into the Microsoft SQL Server 2018 database. Some professional and practical data validation
methods are also discussed in this chapter to confirm the data insertion.
4 Chapter 1 Introduction
●● Chapter 7 provides discussions and analyses on three popular data updating and deleting methods
with four real project examples:
1) Using TableAdapter DBDirect. methods such as TableAdapter.Update() and TableAdapter.Delete() to
update and delete data directly again the databases.
2) Using TableAdapter.Update() method to update and execute the associated TableAdapter’s proper-
ties such as UpdateCommand or DeleteCommand to save changes made for the table in the DataSet
to the table in the database.
3) Using the run time object method to develop and execute the Command’s method ExecuteNonQuery()
to update or delete data again the database directly.
This chapter is also divided into two parts: Methods 1 and 2 are related to Visual Studio.NET design tools
and wizards and therefore are covered in Part I. The third method is related to runtime object and it is
covered in Part II. Four real projects are used to illustrate how to perform the data updating and deleting
against the database Microsoft SQL Server 2018. Some professional and practical data validation methods
are also discussed in this chapter to confirm the data updating and deleting actions. The key points in
performing the data updating and deleting actions against a relational database, such as the order to exe-
cute data updating and deleting between the parent and child tables, are also discussed and analyzed.
●● Chapter 8 provides introductions and discussions about the developments and implementations of
ASP.NET Web applications in Visual Basic.NET 2017 environment. At the beginning of Chapter 8, a
detailed and complete description about the ASP.NET and the .NET Framework is provided, and this
part is especially useful and important to students or programmers who do not have any knowledge or
background in the Web application developments and implementations. Following the introduction
section, a detailed discussion on how to install and configure the environment to develop the ASP.NET
Web applications is provided. Some essential tools such as the Web server, IIS and FrontPage Server
Extension 2000, as well as the installation process of these tools are introduced and discussed in detail.
Starting from section 8.3, the detailed development and building process of ASP.NET Web applications
to access databases are discussed with four real Web application projects. The popular database SQL
Server 2018 is utilized as the target databases for those development and building processes.
●● Chapter 9 provides introductions and discussions about the developments and implementations of
ASP.NET Web services in Visual Basic.NET 2017 environment. A detailed discussion and analysis
about the structure and components of the Web services is provided at the beginning of this chapter.
One of the most popular databases, Microsoft SQL Server 2018, is discussed and used for three kinds
of example Web service projects, which include:
1) WebServiceSQLSelect
2) WebServiceSQLInsert
3) WebServiceSQLUpdateDelete.
Each Web service contains different Web methods that can be used to access different databases and
perform the desired data actions such as Select, Insert, Update, and Delete via the Internet. To consume
those Web services, different Web service client projects are also developed in this chapter. Both
Windows-based and Web-based Web service client projects are discussed and built for each kind of Web
service listed above. Totally nine (9) projects, including the Web service and the associated Web service
client projects, are developed in this chapter. All projects have been debugged and tested and can be run
in any Windows compatible operating systems such as Windows XP, Windows 7/8 and Windows 10.
1.4 How This Book Is Organized and How to Use This Boo 5
1.4 How This Book Is Organized and How to Use This Book
This book is designed for both college students who are new to database programming with Visual Basic.
NET and professional database programmers who has professional experience on this topic.
Chapters 2, 3, and 4 provide the fundamentals on database structures and components, ADO.NET
and LINQ components. Starting from chapter 5, which includes chapters 6 and 7, each chapter is
divided into two parts: fundamental part and advanced part. The data driven applications developed
with design tools and wizards provided by Visual Studio.NET, which can be considered as the funda-
mental part, have less coding-loads and therefore they are more suitable to students or programmers
who are new to the database programming with Visual Basic.NET. Part II contains the runtime object
method and it covers a lot of coding developments to perform the different data actions against the
database, and this method is more flexible and convenient to experienced programmers event a lot of
coding jobs is concerned.
Chapters 8 and 9 give a full discussion and analysis about the developments and implementations
of ASP.NET Web applications and Web services. These technologies are necessary to students and
programmers who want to develop and build Web applications and Web services to access and manip-
ulate data via Internet.
Based on the organization of this book we described above, this book can be used as two categories
such as Level I and Level II, which is shown in Figure 1.1.
For undergraduate college students or beginning software programmers, it is highly recommended to
learn and understand the contents of Chapters 2, 3, and 4, Part I of Chapters 5, 6, and 7 since those are
fundamental knowledge and techniques in database programming with Visual Basic.NET 2017. For
chapters 8 and 9, these areoptional to instructors and dependent on the time and schedule.
Level I
Chapter 2 Level II
Part I Part II
Chapter 5 Chapter 5
Part I Part II
Chapter 6 Chapter 6
Part I Part II
Chapter 7 Chapter 7
Optional
Chapter 8 Chapter 8
Chapter 9 Chapter 9
For experienced college students or software programmers who have already some knowledge and
techniques in database programming, it is recommended to learn and understand the contents of Part II
of Chapters 5 ~ 7 as well as Chapters 8 and 9 since the run-time data objects method and some sophisti-
cated database programming techniques such as joined-table query and nested stored procedures are
discussed and illustrated in those chapters with real examples. Also, the ASP.NET Web applications and
ASP.NET Web services are discussed and analyzed with many real database program examples for SQL
Server 2018 database.
All source codes in each project developed in this book are available, and all projects are categorized into
the associated chapters that are located at the folder DB Projects that is located at the site www.wiley.
com/go/bai/sql. You can copy or download those codes into your computer and run each project as you
like. To successfully run those projects, the following conditions must be met:
●● Visual Studio.NET 2017 or higher must be installed in your computer.
●● The database management system, Microsoft SQL Server 2018 Management Studio 18, must be
installed in your computer.
●● The sample database, CSE_DEPT.mdf, must be installed in your computer in the appropriate
folders.
●● To run projects developed in Chapters 8 and 9, in addition to conditions listed above, an Internet
Information Services (IIS) such as FrontPage Server Extension 2000 or 2002 must be installed in your
computer and it works as a pseudo server for those projects.
All related teaching and learning materials, including the sample databases, example projects, home-
work solutions, faculty and student images as well as sample Windows forms and Web pages, can be
found from the associated folders, Instructors or Students, located at the Wiley ftp site www.wiley.
com/go/bai/sql, as shown in Figure 1.2.
These materials are categorized and stored at different folders in two different sites based on the teach-
ing purpose (for instructors) and learning purpose (for students):
1) Sample Database Folder: Contains our sample database, CSE_DEPT.mdf (SQL Server 2018). Refer
to Appendix D to get details in how to use this database for your applications or sample projects.
2) DB Projects Folder: Contains all sample projects developed in the book. Projects are categorized and
stored at different Chapter subfolder based on the book chapter sequence. Readers can directly use the
codes and GUIs of those projects by downloading them from the DB Projects folder at the Wiley ftp
site.
3) Images Folder: Contains all sample faculty and student image files used in all sample projects in the
book. Readers can copy and paste those image files to their projects to use them.
4) VB Forms Folder: Contains all sampled Windows-based Forms and Web-based Pages developed and
implemented in all sample projects in the book. All Windows-based Forms are located at the Window
subfolder, and all Web-based Pages are located at the Web subfolder. Readers can use those Forms or
Pages by copying and pasting them into their real projects.
5) TeachingPPT Folder: Contains all MS-PPT teaching slides for each chapter.
1.5 How to Use Source Codes and Sample Databas 7
FOR INSTRUCTORS:
FOR STUDENTS:
DB Projects
Chapter 6 8-Student
Web Images
3 Projects
LogIn Page
Chapter 7
Faculty Page 4 Projects
Course Page
Student Page Chapter 8
4 Projects
Selection Page
Chapter 9
9 Projects
BOOTHS.
The precincts of St Giles’s being now secularised, the church itself
was, in 1628, degraded by numerous wooden booths being stuck up
around it. Yet, to show that some reverence was still paid to the
sanctity of the place, the Town-council decreed that no tradesmen
should be admitted to these shops except bookbinders, mortmakers
(watchmakers), jewellers, and goldsmiths. Bookbinders must here be
meant to signify booksellers, the latter term not being then known in
Scotland. Of mortmakers there could not be many, for watches were
imported from Germany till about the conclusion of the seventeenth
century. The goldsmiths were a much more numerous tribe than
either of their companions; for at that time there prevailed in
Scotland, amongst the aristocracy, a sort of rude magnificence and
taste for show extremely favourable to these tradesmen.
Old St Giles’s.
In 1632, the present great hall of the Parliament House was founded
upon the site of the houses formerly occupied by the ministers of St
Giles’s. It was finished in 1639, at an expense of £11,630 sterling,
and devoted to the use of parliament.
It does not appear to have been till after the Restoration that the
Parliament Close was formed, by the erection of a line of private
buildings, forming a square with the church. These houses, standing
on a declivity, were higher on one side than the other; one is said to
have been fifteen stories altogether in height. All, however, were
burned down in a great fire which happened in 1700, after which
buildings of twelve stories in height were substituted.[80]
Among the noble inhabitants of the Parliament Close at an early
period, the noble family of Wemyss were not the least considerable.
At the time of Porteous’s affair, when Francis, the fifth earl, was a
boy, his sisters persuaded him to act the part of Captain Porteous in
a sort of drama which they got up in imitation of that strange scene.
The foolish romps actually went the length of tucking up their
brother, the heir of the family, by the neck, over a door; and their
sports had well-nigh ended in a real tragedy, for the helpless
representative of Porteous was black in the face before they saw the
necessity of cutting him down.[81]
The small booths around St Giles’s continued, till 1817, to deform
the outward appearance of the church. Long before their
destruction, the booksellers at least had found the space of six or
seven feet too small for the accommodation of their fast-increasing
wares, and removed to larger shops in the elegant tenements of the
square. One of the largest of the booths, adjacent to the south side
of the New or High Church, and having a second story, was
occupied, during a great part of the last century, by Messrs Kerr and
Dempster, goldsmiths. The first of these gentlemen had been
member of parliament for the city, and was the last citizen who ever
held that office [in the Scottish parliament]. Such was the humility of
people’s wishes in those days respecting their houses, that this
respectable person actually lived, and had a great number of
children, in the small space of the flat over the shop and the cellar
under it, which was lighted by a grating in the pavement of the
square. The subterraneous part of his house was chiefly devoted to
the purposes of a nursery, and proved so insalubrious that all his
children died successively at a particular age, with the exception of
his son Robert, who, being born much more weakly than the rest,
had the good luck to be sent to the country to be nursed, and
afterwards grew up to be the author of a work entitled The Life of
Robert Bruce, and the editor of a large collection of voyages and
travels.
GOLDSMITHS.
The goldsmiths of those days were considered a superior class of
tradesmen; they appeared in public with scarlet cloak, cocked hat,
and cane, as men of some consideration. Yet in their shops every
one of them would have been found working with his own hands at
some light labour, in a little recess near the window, generally in a
very plain dress, but ready to come forth at a moment’s notice to
serve a customer. Perhaps, down to 1780, there was not a goldsmith
in Edinburgh who did not condescend to manual labour.
As the whole trade was collected in the Parliament Close, this was of
course the place to which country couples resorted, during the last
century, in order to make the purchase of silver tea-spoons, which
always preceded their nuptials. It was then as customary a thing in
the country for the intending bridegroom to take a journey, a few
weeks before his marriage, to the Parliament Close, in order to buy
the silver spoons, as it was for the bride to have all her clothes and
stock of bed-furniture inspected by a committee of matrons upon the
wedding eve. And this important transaction occasioned two
journeys: one, in order to select the spoons, and prescribe the
initials which were to be marked upon them; the other, to receive
and pay for them. It must be understood that the goldsmiths of
Edinburgh then kept scarcely any goods on hand in their shops, and
that the smallest article had to be bespoken from them some time
before it was wanted. A goldsmith, who entered as an apprentice
about the beginning of the reign of George III., informed me that
they were beginning only at that time to keep a few trifling articles
on hand. Previously another old custom had been abolished. It had
been usual, upon both the occasions above mentioned, for the
goldsmith to adjourn with his customer to John’s Coffee-house,[82]
or to the Baijen-hole,[83] and to receive the order or the payment, in
a comfortable manner, over a dram and a caup of small ale; which
were upon the first occasion paid for by the customer, and upon the
second by the trader; and the goldsmith then was perhaps let into
the whole secret counsels of the rustic, including a history of his
courtship—in return for which he would take pains to amuse his
customer with a sketch of the city news. In time, as the views and
capitals of the Parliament Close goldsmiths became extended, all
these pleasant customs were abandoned.[84]
HERIOT’S HOSPITAL
from Greyfriars’ Churchyard.
Page 113.
GEORGE HERIOT.
The shop and workshop of George Heriot existed in this
neighbourhood till 1809, when the extension of the Advocates’
Library occasioned the destruction of some interesting old closes to
the west of St Giles’s Kirk, and altered all the features of this part of
the town. There was a line of three small shops, with wooden
superstructures above them, extending between the door of the Old
Tolbooth and that of the Laigh Council-house, which occupied the
site of the present lobby of the Signet Library. A narrow passage led
between these shops and the west end of St Giles’s; and George
Heriot’s shop, being in the centre of the three, was situated exactly
opposite to the south window of the Little Kirk. The back windows
looked into an alley behind, called Beith’s or Bess Wynd. In
confirmation of this tradition, George Heriot’s name was discovered
upon the architrave of the door, being carved in the stone, and
apparently having served as his sign. Besides this curious memorial,
the booth was also found to contain his forge and bellows, with a
hollow stone, fitted with a stone cover or lid, which had been used
as a receptacle for and a means of extinguishing the living embers of
the furnace, upon closing the shop at night. All these curiosities
were bought by the late Mr E. Robertson of the Commercial Bank,
who had been educated in Heriot’s Hospital, and by him presented
to the governors, who ordered them to be carefully deposited and
preserved in the house, where they now remain. George Heriot’s
shop was only about seven feet square! Yet his master, King James,
is said to have sometimes visited him and been treated by him here.
There is a story that one day, when the goldsmith visited His Majesty
at Holyrood, he found him sitting beside a fire, which, being
composed of perfumed wood, cast an agreeable smell through the
room. Upon George Heriot remarking its pleasantness, the king told
him that it was quite as costly as it was fine. Heriot said that if His
Majesty would come and pay him a visit at his shop, he would show
him a still more costly fire.
‘Indeed!’ said the king; ‘and I will.’ He accordingly paid the goldsmith
a visit, but was surprised to find only an ordinary fire. ‘Is this, then,
your fine fire?’ said he.
‘Wait a little,’ said George, ‘till I get my fuel.’ So saying, he took from
his bureau a bond for two thousand pounds which he had lent to the
king, and laying it in the fire, added: ‘Now, whether is your Majesty’s
fire or mine most expensive?’
‘Yours most certainly, Master Heriot,’ said the king.
Adjacent to George Heriot’s shop, and contiguous to the Laigh
Council-house, there was a tavern, in which a great deal of small
legal business used to be transacted in bygone times. Peter
Williamson, an original and singular person, who had long been in
North America, and therefore designated himself ‘from the other
world,’ kept this house for many years.[85] It served also as a sort of
vestry to the Tolbooth Church, and was the place where the
magistrates took what was called the Deid-chack—that is, a
refreshment or dinner, of which those dignitaries always partook
after having attended an execution. The Deid-chack is now abjured,
like many other of those fashions which formerly rendered the office
of a magistrate so much more comfortable than it now is.[86]
The various kirks which compose St Giles’s had all different
characters in former times. The High Kirk had a sort of dignified
aristocratic character, approaching somewhat to prelacy, and was
frequented only by sound church-and-state men, who did not care
so much for the sermon as for the gratification of sitting in the same
place with His Majesty’s Lords of Council and Session and the
magistrates of Edinburgh, and who desired to be thought men of
sufficient liberality and taste to appreciate the prelections of Blair.
The Old Kirk, in the centre of the whole, was frequented by people
who wished to have a sermon of good divinity, about three-quarters
of an hour long, and who did not care for the darkness and
dreariness of their temple. The Tolbooth Kirk was the peculiar resort
of a set of rigid Calvinists from the Lawnmarket and the head of the
Bow, termed the Towbuith-Whigs, who loved nothing but extempore
evangelical sermons, and would have considered it sufficient to bring
the house down about their ears if the precentor had ceased, for
one verse, the old hillside fashion of reciting the lines of the psalm
before singing them. Dr Webster, of convivial memory, was long one
of the clergymen of this church, and deservedly admired as a pulpit
orator; though his social habits often ran nigh to scandalise his
devout and self-denying congregation.
The inhabitants and shopkeepers of the Parliament Square were in
former times very sociable and friendly as neighbours, and formed
themselves into a sort of society, which was long known by the
name of The Parliament-Close Council. Of this association there were
from fifty to a hundred members, who met once or twice a year at a
dinner, when they usually spent the evening, as the newspaper
phrase goes, ‘in the utmost harmony.’ The whim of this club
consisted in each person assuming a titular dignity at the dinner, and
being so called all the year after by his fellow-members. One was
Lord Provost of Edinburgh, another was Dean of Guild, some were
bailies, others deacons, and a great proportion state-officers. Sir
William Forbes, who, with the kindness of heart which characterised
him, condescended to hold a place in this assemblage of mummers,
was for a long time Member for the City.
Previous to the institution of the police-court, a bailie of Edinburgh
used to sit, every Monday, at that part of the Outer Parliament
House where the statue of Lord Melville now stands, to hear and
decide upon small causes—such as prosecutions for scandals and
defamation, or cases of quarrels among the vulgar and the
infamous. This judicature, commonly called the Dirt Court, was
chiefly resorted to by washerwomen from Canonmills and the
drunken ale-wives of the Canongate. A list of Dirt-Court processes
used always to be hung up on a board every Monday morning at one
of the pillars in the piazza at the outside of the Parliament Square;
and that part of the piazza, being the lounge of two or three low
pettifoggers who managed such pleas, was popularly called the
Scoundrels’ Walk. Early on Monday, it was usual to see one or two
threadbare personages, with prodigiously clean linen, bustling about
with an air of importance, and occasionally accosted by viragoes
with long-eared caps flying behind their heads. These were the
agents of the Dirt Court, undergoing conference with their clients.
There was something lofty and august about the Parliament Close,
which we shall scarcely ever see revived in any modern part of the
town; so dark and majestic were the buildings all round, and so
finely did the whole harmonise with the ancient cathedral which
formed one of its sides! Even the echoes of the Parliament Square
had something grand in them. Such, perhaps, were the feelings of
William Julius Mickle when he wrote a poem on passing through the
Parliament Close of Edinburgh at midnight,[87] of which the following
is one of the best passages:
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com