100% found this document useful (2 votes)
21 views

SQL Server Database Programming With Visual Basic NET Concepts Designs and Implementations Ying Bai download

The document is a comprehensive guide on SQL Server Database Programming using Visual Basic.NET, authored by Ying Bai. It covers concepts, designs, and implementations, detailing database fundamentals, ADO.NET, and Language Integrated Query (LINQ). The book is structured to support both beginners and advanced users in database programming and management.

Uploaded by

hamenpynes6z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
21 views

SQL Server Database Programming With Visual Basic NET Concepts Designs and Implementations Ying Bai download

The document is a comprehensive guide on SQL Server Database Programming using Visual Basic.NET, authored by Ying Bai. It covers concepts, designs, and implementations, detailing database fundamentals, ADO.NET, and Language Integrated Query (LINQ). The book is structured to support both beginners and advanced users in database programming and management.

Uploaded by

hamenpynes6z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 67

SQL Server Database Programming With Visual

Basic NET Concepts Designs and Implementations


Ying Bai pdf download

https://textbookfull.com/product/sql-server-database-programming-
with-visual-basic-net-concepts-designs-and-implementations-ying-
bai/

Download more ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

Beginning Database Programming Using ASP NET Core 3


With MVC Razor Pages Web API jQuery Angular SQL Server
and NoSQL 1st Edition Bipin Joshi

https://textbookfull.com/product/beginning-database-programming-
using-asp-net-core-3-with-mvc-razor-pages-web-api-jquery-angular-
sql-server-and-nosql-1st-edition-bipin-joshi/

SQL Server Execution Plans For SQL Server 2008 through


to 2017 and Azure SQL Database 3rd Edition Grant
Fritchey

https://textbookfull.com/product/sql-server-execution-plans-for-
sql-server-2008-through-to-2017-and-azure-sql-database-3rd-
edition-grant-fritchey/

Programming with Microsoft Visual Basic 2017 Diane Zak

https://textbookfull.com/product/programming-with-microsoft-
visual-basic-2017-diane-zak/

Pro SQL Server Relational Database Design and


Implementation 5th Edition Louis Davidson

https://textbookfull.com/product/pro-sql-server-relational-
database-design-and-implementation-5th-edition-louis-davidson/
Pro SQL Server Relational Database Design and
Implementation Sixth Edition Louis Davidson

https://textbookfull.com/product/pro-sql-server-relational-
database-design-and-implementation-sixth-edition-louis-davidson/

SQL Easy SQL Programming Database Management for


Beginners Your Step By Step Guide to Learning the SQL
Database Felix Alvaro

https://textbookfull.com/product/sql-easy-sql-programming-
database-management-for-beginners-your-step-by-step-guide-to-
learning-the-sql-database-felix-alvaro/

Programming with Microsoft Visual Basic 2015 7th


Edition Diane Zak

https://textbookfull.com/product/programming-with-microsoft-
visual-basic-2015-7th-edition-diane-zak/

Modern Data Access with Entity Framework Core: Database


Programming Techniques for .NET, .NET Core, UWP, and
Xamarin with C# 1st Edition Holger Schwichtenberg

https://textbookfull.com/product/modern-data-access-with-entity-
framework-core-database-programming-techniques-for-net-net-core-
uwp-and-xamarin-with-c-1st-edition-holger-schwichtenberg/

Modern Data Access with Entity Framework Core: Database


Programming Techniques for . NET, . NET Core, UWP, and
Xamarin with C# 1st Edition Holger Schwichtenberg

https://textbookfull.com/product/modern-data-access-with-entity-
framework-core-database-programming-techniques-for-net-net-core-
uwp-and-xamarin-with-c-1st-edition-holger-schwichtenberg-2/
SQL Server Database Programming
with Visual Basic.NET
IEEE Press
445 Hoes Lane
Piscataway, NJ 08854

IEEE Press Editorial Board


Ekram 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 Engineering
Johnson C. Smith University
Charlotte, 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–dc23
LC record available at https://lccn.loc.gov/2020016203
LC ebook record available at https://lccn.loc.gov/2020016204

Cover Design: Wiley


Cover Image: © Hoxton/Martin Barraud/Getty Images

Set in 9.5/12.5pt STIXTwoText by SPi Global, Pondicherry, India

Printed in the United States of America.

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

About the Author xix


Preface xxi
Acknowledgment xxiii
About the Companion Website xxiv

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

Chapter 2 Introduction to Databases 9


Ying Bai and Satish Bhalla
2.1 ­What Are Databases and Database Programs? 10
2.1.1 File Processing System 10
2.1.2 Integrated Databases 11
2.2 ­Develop a Database 12
2.3 ­Sample Database 13
2.3.1 Relational Data Model 13
2.3.2 Entity-Relationship Model (ER) 17
2.4 ­Identifying Keys 18
2.5 ­Define Relationships 18
2.6 ­ER Notation 22
2.7 ­Data Normalization 23
2.7.1 First Normal Form (1NF) 23
2.7.2 Second Normal Form (2NF) 24
2.7.3 Third Normal Form (3NF) 26
2.8 ­Database Components in Some Popular Databases 28
2.8.1 Microsoft Access Databases 28
2.8.2 SQL Server Databases 29
viii Contents

2.8.3 Oracle Databases 32


2.9 ­Create Microsoft SQL Server 2017 Express Sample Database 35
2.9.1 Create the LogIn Table 36
2.9.2 Create the Faculty Table 37
2.9.3 Create Other Tables 39
2.9.4 Create Relationships Among Tables 45
2.9.4.1 Create Relationship Between the LogIn and the Faculty Tables 46
2.9.4.2 Create Relationship Between the LogIn and the Student Tables 49
2.9.4.3 Create Relationship Between the Faculty and the Course Tables 50
2.9.4.4 Create Relationship Between the Student and the StudentCourse Tables 50
2.9.4.5 Create Relationship Between the Course and the StudentCourse Tables 51
2.9.5 Store Images to the SQL Server 2017 Express Database 53
2.10 ­Chapter Summary 61
Homework 63

Chapter 3 Introduction to ADO.NET 67


3.1 ­The ADO and ADO.NET 67
3.2 ­Overview of the ADO.NET 69
3.3 ­The Architecture of the ADO.NET 70
3.4 ­The Components of ADO.NET 71
3.4.1 The Data Provider 72
3.4.1.1 The ODBC Data Provider 73
3.4.1.2 The OLEDB Data Provider 73
3.4.1.3 The SQL Server Data Provider 74
3.4.1.4 The Oracle Data Provider 74
3.4.2 The Connection Class 74
3.4.2.1 The Open() Method of the Connection Class 77
3.4.2.2 The Close() Method of the Connection Class 77
3.4.2.3 The Dispose() Method of the Connection Class 78
3.4.3 The Command and the Parameter Classes 78
3.4.3.1 The Properties of the Command Class 79
3.4.3.2 The Constructors and Properties of the Parameter Class 79
3.4.3.3 Parameter Mapping 80
3.4.3.4 The Methods of the ParameterCollection Class 82
3.4.3.5 The Constructor of the Command Class 83
3.4.3.6 The Methods of the Command Class 84
3.4.4 The DataAdapter Class 87
3.4.4.1 The Constructor of the DataAdapter Class 87
3.4.4.2 The Properties of the DataAdapter Class 87
3.4.4.3 The Methods of the DataAdapter Class 88
3.4.4.4 The Events of the DataAdapter Class 88
3.4.5 The DataReader Class 90
3.4.6 The DataSet Component 92
Contents ix

3.4.6.1 The DataSet Constructor 94


3.4.6.2 The DataSet Properties 94
3.4.6.3 The DataSet Methods 94
3.4.6.4 The DataSet Events 94
3.4.7 The DataTable Component 97
3.4.7.1 The DataTable Constructor 98
3.4.7.2 The DataTable Properties 98
3.4.7.3 The DataTable Methods 99
3.4.7.4 The DataTable Events 100
3.4.8 ADO.NET Entity Framework 102
3.4.8.1 Advantages of Using the Entity Framework 6 104
3.4.8.2 The ADO.NET 4.3 Entity Data Model 106
3.4.8.3 Using Entity Framework 6 Entity Data Model Wizard 110
3.5 ­Chapter Summary 118
Homework 120

Chapter 4 Introduction to Language Integrated Query (LINQ) 123


4.1 ­Overview of Language Integrated Query 123
4.1.1 Some Special Interfaces Used in LINQ 124
4.1.1.1 The IEnumerable and IEnumerable(Of T) Interfaces 124
4.1.1.2 The IQueryable and IQueryable(Of T) Interfaces 125
4.1.2 Standard Query Operators 126
4.1.3 Deferred Standard Query Operators 127
4.1.4 Non-Deferred Standard Query Operators 131
4.2 ­Introduction to LINQ Query 135
4.3 ­The Architecture and Components of LINQ 137
4.3.1 Overview of LINQ to Objects 138
4.3.2 Overview of LINQ to DataSet 139
4.3.3 Overview of LINQ to SQL 139
4.3.4 Overview of LINQ to Entities 140
4.3.5 Overview of LINQ to XML 140
4.4 ­LINQ to Objects 141
4.4.1 LINQ and ArrayList 142
4.4.2 LINQ and Strings 143
4.4.2.1 Query a String to Determine the Number of Numeric Digits 144
4.4.2.2 Sort Lines of Structured Text By any Field in the Line 145
4.4.3 ­LINQ and File Directories 147
4.4.3.1 Query the Contents of Files in a Folder 148
4.4.4 LINQ and Reflection 150
4.5 ­LINQ to DataSet 152
4.5.1 Operations to DataSet Objects 152
4.5.1.1 Query Expression Syntax 153
4.5.1.2 Method-Based Query Syntax 154
x Contents

4.5.1.3 Query the Single Table 157


4.5.1.4 Query the Cross Tables 159
4.5.1.5 Query Typed DataSet 162
4.5.2 Operations to DataRow Objects Using the Extension Methods 165
4.5.3 Operations to DataTable Objects 169
4.6 ­LINQ to SQL 170
4.6.1 LINQ to SQL Entity Classes and DataContext Class 171
4.6.1.1 Add LINQ to Data Reference 171
4.6.1.2 Add LINQ To SQL Tools 171
4.6.2 LINQ to SQL Database Operations 175
4.6.2.1 Data Selection Query 175
4.6.2.2 Data Insertion Query 177
4.6.2.3 Data Updating Query 178
4.6.2.4 Data Deletion Query 179
4.6.3 LINQ to SQL Implementations 182
4.7 ­LINQ to Entities 182
4.7.1 The Object Services Component 183
4.7.2 The ObjectContext Component 183
4.7.3 ­The ObjectQuery Component 184
4.7.4 ­LINQ to Entities Flow of Execution 184
4.7.5 ­Implementation of LINQ to Entities 186
4.8 ­LINQ to XML 187
4.8.1 LINQ to XML Class Hierarchy 187
4.8.2 Manipulate XML Elements 188
4.8.2.1 Creating XML from Scratch 188
4.8.2.2 Insert XML 190
4.8.2.3 Update XML 191
4.8.2.4 Delete XML 192
4.8.3 Manipulate XML Attributes 192
4.8.3.1 Add XML Attributes 192
4.8.3.2 Get XML Attributes 193
4.8.3.3 Delete XML Attributes 193
4.8.4 Query XML with LINQ to XML 194
4.8.4.1 Standard Query Operators and XML 194
4.8.4.2 XML Query Extensions 195
4.8.4.3 Using Query Expressions with XML 196
4.8.4.4 Using XPath and XSLT with LINQ to XML 196
4.8.4.5 Mixing XML and Other Data Models 197
4.9 ­Visual Basic.NET Language Enhancement for LINQ 199
4.9.1 Lambda Expressions 199
4.9.2 Extension Methods 201
4.9.3 Implicitly Typed Local Variables 205
4.9.4 Query Expressions 206
4.10 ­Chapter Summary 208
Homework 209
Contents xi

Chapter 5 Data Selection Query with Visual Basic.NET 215


­ PART I Data Query with Visual Studio.NET Design Tools and Wizards 216
5.1 A Completed Sample Database Application Example 216
5.2 Visual Studio.NET Design Tools and Wizards 219
5.2.1 Data Components in the Toolbox Window 220
5.2.1.1 The DataSet 220
5.2.1.2 DataGridView 221
5.2.1.3 BindingSource 222
5.2.1.4 BindingNavigator 222
5.2.1.5 TableAdapter 223
5.2.1.6 TableAdapter Manager 223
5.2.2 Data Source Window 223
5.2.2.1 Add New Data Sources 224
5.2.2.2 Data Source Configuration Wizard 224
5.2.2.3 DataSet Designer 228
5.3 Query Data from SQL Server Database Using Design Tools and Wizards 231
5.3.1 Application User Interface 231
5.3.1.1 The LogIn Form 232
5.3.1.2 The Selection Form 232
5.3.1.3 The Faculty Form 232
5.3.1.4 The Course Form 234
5.3.1.5 The Student Form 234
5.4 Use Visual Studio Wizards and Design Tools to Query and Display Data 236
5.4.1 Query and Display Data using the DataGridView and Detail Controls 236
5.4.1.1 View the Entire Table 238
5.4.1.2 View Each Record or the Specified Columns with Detail View 241
5.4.2 Use DataSet Designer to Edit the Structure of the DataSet 243
5.4.3 Bind Data to the Associated Controls in LogIn Form 245
5.4.4 Develop Codes to Query Data Using the Fill() Method 249
5.4.5 Use Return a Single Value to Query Data for LogIn Form 251
5.4.6 Develop the Codes for the Selection Form 254
5.4.7 Query Data from the Faculty Table for the Faculty Form 256
5.4.8 Develop Codes to Query Data from the Faculty Table 258
5.4.8.1 Develop Codes to Query Data Using the TableAdapter Method 258
5.4.8.2 Develop Codes to Query Data Using the LINQ to DataSet Method 261
5.4.9 Query Data from the Course Table for the Course Form 262
5.4.9.1 Build the Course Queries Using the Query Builder 263
5.4.9.2 Bind Data Columns to the Associated Controls in the Course Form 265
5.4.9.3 Develop Codes to Query Data for the Course Form 267

­ PART II Data Query with Runtime Objects 271


5.5 Introduction to Runtime Objects 272
5.5.1 Procedure of Building a Data-Driven Application Using Runtime Object 274
5.6 Query Data from SQL Server Database Using Runtime Object 274
5.6.1 Access to SQL Server Database 274
xii Contents

5.6.2 Declare Global Variables and Runtime Objects 276


5.6.3 Query Data Using Runtime Objects for the LogIn Form 278
5.6.3.1 Connect to the Data Source with the Runtime Object 278
5.6.3.2 Coding for Method 1: Using the TableAdapter to Query Data 279
5.6.3.3 Coding for Method 2: Using the DataReader to Query Data 281
5.6.4 The Coding for the Selection Form 283
5.6.5 Query Data Using Runtime Objects for the Faculty Form 284
5.6.5.1 Using Three Query Methods to Retrieve Images from SQL Server Database 290
5.6.6 Query Data Using Runtime Objects for the Course Form 290
5.6.6.1 Retrieve Data from Multiple Tables Using Tables JOINS 293
5.6.7 Query Data Using Runtime Objects for the Student Form 301
5.6.7.1 Query Student Data Using Stored Procedures 302
5.6.7.2 Query Data Using Stored Procedures for Student Form 306
5.6.7.3 Query Data Using More Complicated Stored Procedures 315
5.7 Chapter Summary 320
Homework 321

Chapter 6 Data Inserting with Visual Basic.NET 327


­ PART I Insert Data with Visual Basic.NET Design Tools and Wizards 328
6.1 Insert Data Into a Database 328
6.1.1 Insert New Records into a Database Using the TableAdapter.Insert Method 329
6.1.2 Insert New Records into a Database Using the TableAdapter.Update Method 329
6.2 Insert Data into the SQL Server Database Using a Sample Project InsertWizard 330
6.2.1 Create InsertWizard Project Based on the SelectWizard Project 330
6.2.2 Application User Interfaces 331
6.2.3 Validate Data Before the Data Insertion 331
6.2.3.1 Visual Basic Collection and .NET Framework Collection Classes 331
6.2.3.2 Validate Data Using the Generic Collection 332
6.2.4 Initialization Coding Process for the Data Insertion 335
6.2.5 Build the Insert Query 336
6.2.5.1 Configure the TableAdapter and Build the Data Inserting Query 336
6.2.6 Develop Codes to Insert Data Using the TableAdapter.Insert Method 337
6.2.7 Develop Codes to Insert Data Using the TableAdapter.Update Method 341
6.2.8 Insert Data into the Database Using the Stored Procedures 345
6.2.8.1 Create the Stored Procedure Using the TableAdapter Query Configuration Wizard 346
6.2.8.2 Modify the Codes to Perform the Data Insertion Using the Stored Procedure 346

­ PART II Data Insertion with Runtime Objects 350


6.3 The General Run Time Objects Method 351
6.4 Insert Data into the SQL Server Database Using the Run Time Object Method 352
6.4.1 Insert Data into the Faculty Table for the SQL Server Database 353
6.4.1.1 Validate Data Before the Data Insertion 353
6.4.1.2 Insert Data into the Faculty Table 355
Contents xiii

6.4.1.3 Validate Data After the Data Insertion 357


6.5 Insert Data into the Database Using Stored Procedures 360
6.5.1 Insert Data into the SQL Server Database Using Stored Procedures 360
6.5.1.1 Develop Stored Procedures in SQL Server Database 361
6.5.1.2 Develop Codes to Call Stored Procedures to Insert Data into the Course Table   363
6.6 Insert Data into the Database Using the LINQ To SQL Method 368
6.6.1 Insert Data Into the SQL Server Database Using the LINQ to SQL Queries 369
6.7 Chapter Summary 369
Homework 370

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


­ PART I Data Updating and Deleting with Visual Studio.NET Design Tools and Wizards 378
7.1 Update or Delete Data Against Databases 378
7.1.1 Updating and Deleting Data from Related Tables in a DataSet 379
7.1.2 Update or Delete Data Against Database Using TableAdapter DBDirect
Methods - TableAdapter.Update and TableAdapter.Delete 379
7.1.3 Update or Delete Data Against Database Using TableAdapter.Update Method 380
7.2 Update and Delete Data For Microsoft SQL Server Database 381
7.2.1 Create a New Project Based on the InsertWizard Project 381
7.2.2 Application User Interfaces 382
7.2.3 Validate Data Before the Data Updating and Deleting 382
7.2.4 Build the Update and Delete Queries 382
7.2.4.1 Configure the TableAdapter and Build the Data Updating Query 383
7.2.4.2 Build the Data Deleting Query 384
7.2.5 Develop Codes to Update Data Using the TableAdapter DBDirect Method 385
7.2.5.1 Modifications of the Codes 385
7.2.5.2 Creations of the Codes 385
7.2.6 Develop Codes to Update Data Using the TableAdapter.Update Method 387
7.2.7 Develop Codes to Delete Data Using the TableAdapter DBDirect Method 388
7.2.8 Develop Codes to Delete Data Using the TableAdapter.Update Method 390
7.2.9 Validate the Data After the Data Updating and Deleting 391

­ PART II Data Updating and Deleting with Runtime Objects 395


7.3 The Run Time Objects Method 395
7.4 Update and Delete Data for SQL Server Database Using the Run Time Objects 396
7.4.1 Update Data Against the Faculty Table in the SQL Server Database 397
7.4.1.1 Develop Codes to Update the Faculty Data 397
7.4.1.2 Validate the Data Updating 399
7.4.2 Delete Data from the Faculty Table in the SQL Server Database 399
7.4.2.1 Develop Codes to Delete Data 399
7.4.2.2 Validate the Data Deleting 401
7.5 Update and Delete Data against SQL Server Database Using Stored Procedures 404
7.5.1 Modify an Existing Project to Create Our New Project 405
xiv Contents

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

Chapter 8 Accessing Data in ASP.NET 429


8.1 ­What is .NET Framework? 430
8.2 ­What is ASP.NET? 431
8.2.1 ASP.NET Web Application File Structure 433
8.2.2 ASP.NET Execution Model 433
8.2.3 What is Really Happened When a Web Application is Executed? 434
8.2.4 The Requirements to Test and Run the Web Project 435
8.3 ­Develop ASP.NET Web Application to Select Data from SQL Server Databases 435
8.3.1 Create the User Interface – LogIn Form 436
8.3.2 Develop the Codes to Access and Select Data from the Database 438
8.3.3 Validate the Data in the Client Side 442
8.3.4 Create the Second User Interface – Selection Page 443
8.3.5 Develop the Codes to Open the Other Page 444
8.3.6 Modify the Codes in the LogIn Page to Transfer to the Selection Page 446
8.3.7 Create the Third User Interface – Faculty Page 447
8.3.8 Develop the Codes to Select the Desired Faculty Information 448
8.3.8.1 Develop the Codes for the Page_Load Event Procedure 449
8.3.8.2 Develop the Codes for the Select Button Click Event Procedure 450
8.3.8.3 Develop the Codes for Other Procedures 452
8.3.9 Create the Fourth User Interface – Course Page 454
8.3.9.1 The AutoPostBack Property of the List Box Control 457
8.3.10 Develop the Codes to Select the Desired Course Information 457
8.3.10.1 Coding for the Course Page Loading and Ending Event Procedures 458
8.3.10.2 Coding for the Select Button’s Click Event Procedure 459
8.3.10.3 Coding for the SelectedIndexChanged Event Procedure of the CourseList Box 461
8.3.10.4 Coding for Other User Defined Subroutine Procedures 463
8.4 ­Develop ASP.NET Web Application to Insert Data Into SQL Server Databases 465
8.4.1 Develop the Codes to Perform the Data Insertion Function 466
8.4.2 Develop the Codes for the Insert Button Click Event Procedure 466
Contents xv

8.4.3 Validate the Data Insertion 473


8.5 ­Develop Web Applications to Update and Delete Data in SQL Server Databases 473
8.5.1 Modify the Codes for the Faculty Page 474
8.5.2 Develop the Codes for the Update Button Click Event Procedure 475
8.5.3 Develop the Codes for the Delete Button Click Event Procedure 479
8.5.3.1 Relationships Between Five Tables in Our Sample Database 480
8.5.3.2 Data Deleting Sequence 481
8.5.3.3 Use the Cascade Deleting Option to Simplify the Data Deleting 481
8.5.3.4 Create the Stored Procedure to Perform the Data Deleting 483
8.5.3.5 Develop the Codes to Call the Stored Procedure to Perform the Data Deleting 486
8.6 ­Develop ASP.NET Web Applications with LINQ to SQL Query 489
8.6.1 Create a New Object of the DataContext Class 491
8.6.2 Develop the Codes for the Data Selection Query 492
8.6.3 Develop the Codes for the Data Insertion Query 493
8.6.4 Develop the Codes for the Data Updating and Deleting Queries 496
8.7 ­Chapter Summary 500
Homework 500

Chapter 9 ASP.NET Web Services 505


9.1 ­What Are Web Services and Their Components? 506
9.2 ­Procedures to Build a Web Service 508
9.2.1 The Structure of a Typical Web Service Project 508
9.2.2 The Real Considerations When Building a Web Service Project 509
9.2.3 Introduction to Windows Communication Foundation (WCF) 509
9.2.3.1 What is the WCF? 510
9.2.3.2 WCF Data Services 510
9.2.3.3 WCF Services 511
9.2.3.4 WCF Clients 511
9.2.3.5 WCF Hosting 512
9.2.3.6 WCF Visual Studio Templates 512
9.2.4 Procedures to Build an ASP.NET Web Service 513
9.3 ­Build ASP.NET Web Service Project to Access SQL Server Database 514
9.3.1 Files and Items Created in the New Web Service Project 515
9.3.2 A Feeling of the Hello World Web Service Project As it Runs 518
9.3.3 Modify the Default Namespace 520
9.3.4 Create a Base Class to Handle Error Checking for Our Web Service 522
9.3.5 Create a Customer Returned Class to Hold All Retrieved Data 522
9.3.6 Add Web Methods into Our Web Service Class 524
9.3.7 Develop the Codes for Web Methods to Perform the Web Services 524
9.3.7.1 Web Service Connection Strings 524
9.3.7.2 Modify the Existing HelloWorld Web Method 527
9.3.7.3 Develop the Codes to Perform the Database Queries 528
9.3.7.4 Develop the Codes for Subroutines Used in the Web Method 530
xvi Contents

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

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 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

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


1

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.1 ­Outstanding Features About This Book

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.

1.2 ­This Book Is For

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.

1.3 ­What This Book Covers

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

Chapters 3 & 4 Chapters 3 & 4

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

Figure 1.1 Two study levels in the book.


6 Chapter 1 Introduction

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.

1.5 ­How to Use Source Codes and Sample 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

The Book Related Materials on the Web Sites

FOR INSTRUCTORS:

Instructor materials are available upon request from www.wiley.com/go/bai/sql/Instructors

DB Projects Images HWSolutions


Sample Database TeachingPPT

CSE_DEPT.mdf Chapter 1.ppt HW Solution.pdf


Chapter 5 Chapter 2.ppt Faculty
3 Projects
Chapter 3.ppt 13-Faculty
Chapter 6 Images
3 Projects Chapter 4.ppt

Chapter 7 Chapter 5.ppt


3 Projects Chapter 6.ppt Students
Chapter 8 Chapter 7.ppt 8-Student
1 Project Images
Chapter 8.ppt
Chapter 9 Chapter 9.ppt
6 Projects

FOR STUDENTS:

Learning materials are free to access via the site www.wiley.com/go/bai/sql/Students

DB Projects

Sample Database Images


VB Forms
Chapter 2
CSE_DEPT.mdf 1 Project
Window Faculty
Chapter 3
LogIn Form 1 Project 13-Faculty
Faculty Form Images
Chapter 4
Course Form 13 Projects
Student Form Chapter 5
Selection Form 4 Projects Students

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

Figure 1.2 Book related materials on Web site.


Discovering Diverse Content Through
Random Scribd Documents
through the weary hours as he best may, who bullies her servants
and scolds her children—she too, is a heroine of a class that does
not look well when closely studied. The pretty young mother, making
play with her pretty young children in the Park—a smiling picture of
love and loveliness—when followed home, turning into a fretful, self-
indulgent fine lady, flung wearily into an easy chair, sending the
children up to the nursery and probably seeing them no more until
Park hour to-morrow, when their beautiful little têtes d'ange will
enhance her own loveliness in the eyes of men, and make her more
beautiful because making the picture more complete; Mrs. Jellaby
given up to universal philanthropy, refusing a crust to the beggar at
her own gate, but full of tearful pity for the misery she has
undertaken to mitigate at Borioboolagha; Crœsus scattering showers
of gold abroad, and applauded to the echo when his name, with the
donation following, is read out at a public dinner, but looking after
the cheese-parings at home; the eloquent upholder of human
equality in public, snubbing in private all who are one degree below
him in the social scale, and treating his servants like dogs; the no
less eloquent descanter on the motto Noblesse oblige, when the
house-door is shut between him and the world, running honesty so
fine that it is almost undistinguishable from roguery—all these
heroes abroad show but shabbily at home, and make their heroism
within the four walls literally a vanishing quantity.
People who live on the outside of the charmed circle of letters, but
who believe that the men and women that compose it are of a
different mould from the rest of mankind, and who long to be
permitted to penetrate the rose-hedge and learn the facts of
Armida's garden for themselves, sometimes learn them too clearly
for their dreams to be ever possible again. They have a favourite
author—a poet, say, or a novelist. If a poet, he is probably one
whose songs are full of that delicious melancholy which makes them
so divinely sad; an æsthetic poet; a blighted being; a creature
walking in the moonlight among the graves and watering their
flowers with his tears:—if a novelist, he is one whose sprightly fancy
makes the dull world gay. A friend takes the worshipper to the shrine
where the idol is to be found; in other words, they go to call on him
at his own house. The melancholy poet 'hidden in the light of
thought,' is a rubicund, rosy-gilled gentleman, brisk, middle-aged,
comfortable, respectable, particular as to his wines, a connoisseur as
to the merits of the chef, a bon vivant of the Horatian order, and in
his talk prone to personal gossip and feeble humour. The lively
novelist, on the other hand, is a taciturn, morose kind of person,
afflicted with perennial catarrh, ever ready with an unpleasant
suggestion, given to start disagreeable topics of a grave, not to say
depressing, nature, perhaps a rabid politician incapable of a give-
and-take argument, or a pessimistic economist, taking gloomy views
of the currency and despondent about our carrying trade.
As for the women, they never look the thing they are reputed to be,
save in fashion, and sometimes in beauty. A woman who goes to
public meetings and makes speeches on all kinds of subjects, tough
as well as doubtful, presents herself in society with the look of an
old maid and the address of a shy schoolgirl. A sour kind of essayist,
who finds everything wrong and nothing in its place, has a face like
the full moon and looks as if she fed on cream and butter. A novelist
who sails very near the wind, and on whom the critics are severe by
principle, is as quiet as a Quakeress in her conversation and as
demure as a nun in her bearing; while a writer of religious tracts has
her gowns from Paris and gives small suppers out of the proceeds.
The public character and the private being of almost every person in
the world differ widely from each other; and the hero of history who
is also the hero to his valet has yet to be found.
Some people call this difference inconsistency, and some
manysidedness; to some it argues unreality, to others it is but the
necessary consequence of a complex human nature, and a sign that
the mind needs the rest of alternation just as much as the body. We
cannot be always in the same groove, never changing our attitude
nor object. Is it inconsistency or supplement, contradiction or
compensation? The sterner moralists, and those whose minds dwell
on tares, say the former; those who look for wheat even on the
stony ground and among thorns assert the latter. Anyhow, it is
certain that those who desire ideals and who like to worship heroes
would do well to content themselves with adoration at a long range.
Distance lends enchantment, and ignorance is bliss in more cases
than one. Heroism at home is something like the delicacy of
Brobdingnag, or the grandiosity of Lilliput; and the undress of the
domestic hearth is more favourable to personal comfort than to
public glory. To keep our ideals intact we ought to keep them
unknown. Our goddesses should not be seen eating beefsteaks and
drinking stout; our poets are their best in print, and social small-talk
does not come like truths divine mended from their tongue; our
sages and philanthropists gain nothing, and may lose much, by
being rashly followed to their firesides. Yet a man's good work and
brave word are, in any case, part of his real self, though they may
not be the whole; and even if he is not true metal all through, his
gold, so far as it goes, counts for more than its alloy, and his public
heroism overtops his private puerility.
SEINE-FISHING.

Few braver or hardier men are to be found in England than the


Cornish fishermen. Their business, at all times hazardous, is doubly
so on a coast so dangerous as theirs, where the charm of scenery is
bought at the expense of security. Isolated rocks which are set up
like teeth close round the jagged cliffs and far out from shore,
cropping up at intervals anywhere between Penzance and Scilly;
sunken rocks which are more perilous because more treacherous;
strong currents which on the calmest day keep the sea where they
flow in perpetual turmoil; a singularly tumultuous and changeable
sea, where the ground-swell of the Atlantic sweeps on in long waves
which break into a surf that would swamp any boat put out, even
when there is not a breath of surface-wind stirring; for the most part
a very narrow channel to the coves, a mere water-path as one may
call it, beset by rocks which would break the boats to splinters if
they were thrown against them—all these circumstances make the
trade of the Cornish fishermen exceptionally dangerous; but they
also make the men themselves exceptionally resolute and daring.
They are true fighters with nature for food; and, like the miners,
they feel when they set out to their work that they may never come
back from it alive.
No man can predict what the sea will be an hour or two hence. Its
character changes with each fluctuation of the tide; and a calm and
halcyon lake may have become fierce and angry and tempest-tossed
when the ebb turns and the flow sets in. There are times too, when
a boat caught by the wind and drifted into a current would be as
helpless as a cork in a mill-race; and when a whole fleet of fishing-
boats might be blown out to sea, with perhaps half their number
capsized. But, as a rule, having learnt caution with their hardihood
from the very magnitude of the dangers which surround them, these
Cornish men suffer as little by shipwreck as do the fishermen of
safer bays; and though each cove has its own sad story, and every
rock its victim, the worst cases of wreck have been those of larger
vessels which have mistaken lights, or steered too close in shore, or
been lost in the fogs that are so frequent about the Land's End. Or
they may have been caught by the wind and the tide and driven
dead on to a lee shore; as so often happens in the bay between
Hartland and Padstow Points.
But the more cautious the men are the less money they make; and
though life is certainly more than meat, life without meat at all, or
with only an insufficient quantity, is rather a miserable affair. The
material well-being of the poor fellows who live in those picturesque
little coves which are the delight and the despair of artists is not in a
very satisfactory condition. By the law of aggregation, unification,
whatever we like to call it—the law of the present day by which
individuals are absorbed into bodies that work for wages for one
master, instead of each man working for himself for his own hand—
the independent fishermen are daily becoming fewer. Save at
Whitesand Bay, where there is a 'poor man's seine' and 'a rich man's
seine,' almost all the seine nets belong now to companies or
partnerships of rich men; and in very few have the men themselves
any share.
Fishermen's seines are not well regarded by the wealthy
leaseholders of the cove and foreshore; and the leaseholder has very
large legal rights and powers which it would be idle to blame him for
exercising. The cots are his, and the capstan is his, and the right of
landing is his; thus he can put on the screw when he wants to have
things his own way, and can threaten evictions, and the withdrawal
of the right to the capstan and to the landing-place, if the men will
not go on his seine, but choose either a united one of their own or
independent drift or trawl nets. Some, it is said, even object to the
men fishing at all, at any rate during the seine season; some have
raised the annual rent per boat for cove rights to three or four times
its old rate; and some go through a round of surly suspicion and
irritating supervision during the 'bulking' days, and higgle jealously
over the small share allowed to the hands in the catch. So that, on
the whole, the Cornish fisherman of the smaller coves has not much
to boast of beside his courage and good heart, and a sturdy
independence and honesty specially noticeable.
We know of no more animated scene than seine-fishing. From the
first act to the last there is a quaint old-world flavour about it
inexpressibly charming to people used to the prosaic life of modern
cities. The 'huers' who stand on the hills watching for the first
appearance of the 'school,' and who make known what they see
either by signals or calling through a huge metal trumpet, the sound
of which no one who has once heard it can ever forget; the
smartness of the men dressing the seine-boats which carry the huge
net with all its appurtenances; their quiet but eager watching for the
school to come within practicable distance—that is, into sufficiently
shoal water, and where the bottom is fairly level (else the fish all
escape from under the net); the casting or shooting of the seine
enclosing the school, and then the 'tucking' or lifting the fish from
the sea to the boats—every stage is full of interest; but this last is
the prettiest of all.
Imagine a moonlight night—low water at midnight—when the
tucking begins. The boat cannot come up to the ordinary landing,
which is only a roughly-paved causeway dipping by a gradual
descent into the sea; so those who would share in the sport are fain
to take the fisherman's path along the cliff and drop into the boat off
the rocks. These rocks are never very safe. Even the men
themselves, trained to them as they are from boyhood, sometimes
slip on their slanting, broken, seaweed-covered surfaces, when, if
they cannot swim and are not helped, all is over for them in this life;
and for strangers they are difficult at the best of times. But on an
obscurely lighted night, and after heavy rain, they are doubly risky.
The incoming wave lifts the boat a few inches higher and nearer;
and you must catch the exact moment and make a spring before she
drifts off again with the ebb. The row across the little bay is
beautiful. The grey cliffs look solemn and majestic in the pale light of
the moon; the shadows are deep and unfathomable; everywhere
you see black rocks standing out from the steely sea, and little lines
of breakers mark the place of the sunken rocks. In the distance
shine the magnificent Lizard Lights, and the red and white revolving
light of the terrible Wolf Rock flashes on the horizon; the moon
touches the sea with silver, and the waves as they rise and fall seem
like molten metal in the heavy sluggish rhythm of their flow. Only
round the foot of the cliffs and about the rocks they break into spray
that serves as high lights against the sombre grey and black of the
landscape. You pull across to the opposite point, and then round into
another smaller bay where the cliffs rise sheer, and the seine net is
cast. You come into a little fleet of fishing-boats set round on the
outside of a circle of corks, within which is the master-boat, where
all hands are assembled pulling at the net, to draw it closer. It is a
stirring sight. Some dozen or more stalwart fellows are hauling on
the lines with the sailors' cheery cry and the sailors' exuberant
goodwill. Every now and then the master's voice cries out 'Break!
break my sons!' when they shorten hold and go over to the other
side of the boat, pulling themselves gradually aslant again, till the
same order of 'Break! break!' shows that their purchase is too slack.
At last the net is hauled up close enough, and then the fun begins.
All the boats engaged form a close circle round the inner line of
corks, which is now a little sea of silver where the imprisoned
pilchards beat and flutter, producing a sound for which we have no
satisfactory onomatopoetic word. In moonlight this little sea is silver;
in torchlight it is of fire with varied colours flashing through the
redder gleams; and in the dark it is a sea of phosphorescent light,
each mesh of the net, each fish, each seaweed illuminated as if
traced in flame. Every one is now busy. The men dip in baskets, or
maunds, expressly made for this purpose, and ladle out the
quivering fish by hundreds into the boats. In a few moments they
are standing leg-deep in pilchards. Every one on the spot is pressed
into the service, and even a boat manned by nothing more stalwart
than one or two half-sick and half-frightened women receives its
orders; and 'Hold on ladies! all hands hold on to the boat,' serves to
keep one of the busiest of the tucking-boats in equilibrium.
The men, for all their hearty work, are like a party of schoolboys at
play. Their humour may be rough, but it is never meant to be rude;
their goodwill is sincere, for they have a share, however small, in the
success of the catch; and the more they tuck, the more they will
have for their wives and families to live on through the winter. It is
their harvest-time; and they are as jocund as harvesters proverbially
are. There is no stint of volunteer labour either. Men who have been
working hard all day on their own account go out at midnight to lend
a hand to their mates at the seine. Even though the take is for a
hard-fisted master who would count fins if he could, and who would
refuse his men a head apiece if he thought his orders would be
carried out, they are all honestly glad. They remember the time
when a rich school was the wealth of the whole cove, and when a
string of fresh pilchards would be given freely to any one coming to
the cove at the time of bulking, or, as we should call it, storing.
Still, whatever of economic value there may be in this exploitation of
labour, it has its mournful side in the loss of individual value which it
includes. And no one can help feeling this who listens to the talk of
the elder fishermen, sorrowfully comparing the old days of personal
independence and generous lordship with the present ones of wages
and a wide-awake lesseeship, conscious of its legal rights and
determined to act on them.
When all the fish have been tucked there is nothing for it but to row
home again in the freshening morning air. The tide is rising now, and
the moon is waning. The rocks look blacker, the grey moss-grown
cliffs more solemn, more mysterious, the white surf breaking about
them is higher and sharper than when you set out; and the boom of
the sea thundering through cave and channel has a sound in it that
makes you feel as if land and your own bed would be preferable to
an open boat at the mercy of the Atlantic surges. The tide has so far
risen that you can land nearer to the paved causeway than before;
but even now you have to wait for the flow of the wave, then make
a spring on to the black and slimy rocks, which would be creditable
to trained gymnastic powers. So you go home, under the first
streaks of dawn, wet through and scaly, and smelling abominably of
fish dashed with a streak of tar for a richer kind of compound.
The whole place however, will smell of fish to-morrow and for many
to-morrows. When the tucking-boats are brought in, then the
women take their turn, and pack the pilchards in the fish-cellars or
salting-houses. Here they are said to be in 'bulk,' all laid on their
sides with their noses pointing outwards; layers of salt alternating
with layers of fish. Their great market is Italy, where they serve as
favourite Lenten fare. The Italians believe them to be smoked, and
hence call them fumados. This word the dear thick-headed British
sailor has caught up, according to his wont, and translated into 'fair
maids;' and 'fair maids'—pronounced firmads—is the popular name
of salted pilchards all through Cornwall.
The pilchard fishery begins as early as June or July; but then it is
further out to sea, sometimes twenty miles out. According to the old
saying,

When the corn is in the shock


The fish are at the rock;

harvest-time, which means from August to the end of October, being


the main season for pilchard-fishing in shoal-water close at home.
There are some choice bits of picturesque life still left to us in
faraway places where the ordinary tourist has not penetrated; but
nothing is more picturesque than seine-fishing in one of the wilder
Cornish coves, when the tucking goes on at midnight, either by
moonlight or torchlight, or only by the phosphorescent illumination
of the sea itself. No artist that we can remember at this moment has
yet painted it; but it is a subject which would well repay careful
study and loving handling.
THE DISCONTENTED WOMAN.

The discontented woman would seem to be becoming an


unpleasantly familiar type of character. A really contented woman,
thoroughly well pleased with her duties and her destiny, may almost
be said to be the exception rather than the rule in these days of
tumultuous revolt against all fixed conditions, and vagrant energies
searching for interest in new spheres of thought and action. It
seems impossible to satisfy the discontented woman by any means
short of changing the whole order of nature and society for her
benefit. And even then the chances are that she would get wearied
of her new work, and, like Alexander, would weep for more worlds to
rearrange according to her liking—with the power to take or to leave
the duties she had voluntarily assumed, as she claims now the
power of discarding those which have been hers from the beginning.
As things are, nothing contents her; and the keynote which shall put
her in harmony with existing conditions, or make her ready to bear
the disagreeable burdens which she has been obliged to carry from
Eve's time downward, has yet to be found. If she is unmarried, she
is discontented at the want of romance in her life; her main desire is
to exchange her father's house for a home of her own; her pride is
pained at the prospect of being left an old maid unsought by men;
and her instincts rebel at the thought that she may never know
maternity, the strongest desire of the average woman.
But if she is married, the causes of her discontent are multiplied
indefinitely, and where she was out of harmony with one
circumstance she is now in discord with twenty. She is discontented
on all sides; because her husband is not her lover, and marriage is
not perpetual courtship; because he is so irritable that life with him
is like walking among thorns if she makes the mistake of a hair's-
breadth; or because he is so imperturbably good-natured that he
maddens her with his stolidity, and cannot be made jealous even
when she flirts before his eyes. Or she is discontented because she
has so many household duties to perform—the dinner to order, the
books to keep, the servants to manage; because she has not enough
liberty, or because she has too much responsibility; because she has
so few servants that she has to work with her own hands, or
because she has so many that she is at her wit's end to find
occupation for them all, not to speak of discipline and good
management.
As a mother, she is discontented at the loss of personal freedom
compelled by her condition; at the physical annoyances and mental
anxieties included in the list of her nursery grievances. She would
probably fret grievously if she had no children at all, but she frets
quite as much when they come. In the former case she is
humiliated, in the latter inconvenienced, and in both discontented.
Indeed, the way in which so many women deliver up their children
to the supreme control of hired nurses proves practically enough the
depth of their discontent with maternity when they have it.
If the discontented woman is rich, she speaks despondingly of the
difficulties included in the fit ordering of large means; if she is poor,
life has no joys worth having when frequent change of scene is
unattainable, and the milliner's bill is a domestic calamity that has to
be conscientiously staved off by rigorous curtailment. If she lives in
London, she laments the want of freedom and fresh air for the
children, and makes the unhappy father, toiling at his City office from
ten till seven, feel himself responsible for the pale cheeks and
attenuated legs which are probably to be referred to injudicious diet
and the frequency of juvenile dissipations. But if she is in the
country, then all the charm of existence is centred in London and its
thoroughfares, and not the finest scenery in the world is to be
compared with the attractions of the shops in Regent Street or the
crowds thronging Cheapside.
This question of country living is one that presses heavily on many a
female mind; but we must believe that, in spite of the plausible
reasons so often assigned, the chief causes of discontent are want
of employment and deadness of interest in the life that lies around.
The husband makes himself happy with his rod and gun, with his
garden or his books, with huntsmen or bricklayers, as his tastes lead
him; but the wife—we are speaking of the wife given over to
disappointment and discontent, for there are still, thank Heaven,
bright, busy, happy women both in country and in town—sits over
the fire in winter and by the empty hearth in summer, and finds all
barren because she is without an occupation or an interest within
doors or without. Ask her why she does not garden—if her
circumstances are of the kind where hands are scarce and even a
lady's energies would do potent service among the flower beds; and
she will tell you it makes her back ache, and she does not know a
weed from a flower, and would be sure to pick up the young
seedlings for chickweed and groundsel. And if she is rich and has
hands about her who know their business and guard it jealously, she
takes shelter behind her inability to do actual manual labour side by
side with them.
Within doors active housekeeping is repulsive to her; and though her
servants may be quasi-savages, she prefers the dirt and discomfort
of idleness to the domestic pleasantness to be had by her own
industry and practical assistance. Unless she has a special call
towards some particular party in the Church, she does nothing in the
parish, and seems to think philanthropy and help to one's poorer
neighbours part of the ecclesiastical machinery of the country,
devolving on the Rectory alone. She gets bilious through inaction
and heated rooms, and then says the place disagrees with her and
will be the death of her before long. She cannot breathe among the
mountains; the moor and plain are too exposed; the sea gives her a
fit of melancholy whenever she looks at it, and she calls it cruel,
crawling, hungry, with a passion that sounds odd to those who love
it; she hates the leafy tameness of the woods and longs for the freer
uplands, the vigorous wolds, of her early days.
Wherever, in short, the discontented woman is, it is just where she
would rather not be; and she holds fate and her husband cruel
beyond words because she cannot be transplanted into the exact
opposite of her present position. But mainly and above all she
desires to be transplanted to London. If you were to get her
confidence, she would perhaps tell you she thinks the advice of that
sister who counselled the Lady of Groby to burn down the house,
whereby her husband would be compelled to take her to town, the
wisest and most to the purpose that one woman could give to
another. So she mopes and moons through the days, finding no
pleasure anywhere, taking no interest in anything, viewing herself as
a wifely martyr and the oppressed victim of circumstances; and then
she wonders that her husband is always ready to leave her company
and that he evidently finds her more tiresome than delightful. If she
would cultivate a little content she might probably change the aspect
of things even to finding the mountains beautiful and the sea
sublime; but dissatisfaction with her condition is the Nessus garment
which clings to the unhappy creature like a second self, destroying
all her happiness and the chief part of her usefulness.
Women of this class say that they want more to do, and a wider field
for their energies than any of those assigned to them by the natural
arrangement of personal and social duties. As administrators of the
fortune which man earns, and as mothers—that is, as the directors,
caretakers, and moulders of the future generation—they have as
important functions as those performed by vestrymen and surgeons.
But let that pass for the moment; the question is not where they
ought to find their fitting occupation and their dearest interests, but
where they profess a desire to do so. As it is, this desire for an
enlarged sphere is one form among many which their discontent
takes; yet when they are obliged to work, they bemoan their
hardship in having to find their own food, and think that men should
either take care of them gratuitously or make way for them
chivalrously. In spite of Scripture, they find that the battle is to the
strong and the race to the swift; and they do not like to be
overcome by the one nor distanced by the other. Their idea of a
clear stage is one that includes favour to their own side; yet they put
on airs of indignation and profess themselves humiliated when men
pay the homage of strength to their weakness and treat them as
ladies rather than as equals.
Elsewhere they complain when they are thrust to the side by the
superior force of the ungodly sex; and think themselves ill-used if
fewer hours of labour—and that labour of what Mr. Carlyle called a
'slim' and superficial kind—cannot command the market and hold the
field against the better work and more continuous efforts of men.
There is nothing of which women speak with more bitterness than of
the lower rates of payment usually accorded to their work; nothing
wherein they seem to be so utterly incapable of judging of cause
and effect; or of taking to heart the unchangeable truth that the
best must necessarily win in the long run, and that the first condition
of equality of payment is equality in the worth of the work done. If
women would perfect themselves in those things which they do
already before carrying their efforts into new fields, we cannot but
think it would be better both for themselves and the world.
Life is a bewildering tangle at the best, but the discontented woman
is not the one to make it smoother. The craze for excitement and for
unfeminine publicity of life has possessed her, to the temporary
exclusion of many of the sweeter and more modest qualities which
were once distinctively her own. She must have movement, action,
fame, notoriety; and she must come to the front on public questions,
no matter what the subject, to ventilate her theories and show the
quality of her brain. She must be professional all the same as man,
with M.D. after her name; and perhaps, before long, she will want to
don a horsehair wig over her back hair, and address 'My Lud' on
behalf of some interesting criminal taken red-handed, or to follow
the tortuous windings of Chancery practice. When that time comes,
and as soon as the novelty has worn off, she will be sure to complain
of the hardness of the grind and the woes of competition; and the
obscure female apothecary struggling for patients in a poor
neighbourhood—the unemployed lady lawyer waiting in dingy
chambers for the clients who never come—will look back with envy
and regret to the time when women were cared for by men,
protected and worked for, and had nothing more arduous to do than
attend to the house, spend the money they did not earn and forbear
to add to the anxieties they did not share. Could they get all the
plums and none of the suet it would be fine enough; but we
question whether they will find the battle of life as carried on in the
lower ranks of the hitherto masculine professions one whit more
ennobling or inspiriting than it is now in their own special
departments. Like the poor man who, being well, wished to be
better, and came to the grave as the result, they do not know when
they are well off; and in their search for excitement, and their
discontent with the monotony, undutifulness and inaction which they
have created for themselves, they run great danger of losing more
than they can gain, and of only changing the name, while leaving
untouched the real nature, of the disease under which they are
suffering.
ENGLISH CLERGYMEN IN FOREIGN
WATERING-PLACES.

Those persons who object to the influence of the clergy in their


parishes at home, and who dislike the idea of being laid hold of by
the ecclesiastical crook and dragged perforce up steep ways and
narrow paths, ought to visit some of our little outlying settlements in
foreign parts. They might take a revengeful pleasure in seeing how
the tables there are turned against the tyrants here, and how weak
in the presence of his transmarine flock is the expatriated shepherd
whose rod at home is oftentimes a rod of iron, and his crook more
compelling than persuasive. Of all men the most to be pitied is
surely the clergyman of one of those small English settlements which
are scattered about France and Italy, Germany and Switzerland; and
of all men of education, and what is meant by the position of a
gentleman, he is the most in thraldom.
His very means of living depending on his congregation, he must
first of all please that congregation and keep it in good humour. So,
it may be said, must a clergyman in London whose income is from
pew-rents and whose congregation are not his parishioners. But
London is large; the tempers and thoughts of men are as numerous
as the houses; there is room for all, and lines of affinity for all. The
Broad Churchman will attract his hearers, and the Ritualist his, from
out of the mass, as magnets attract steel filings; and each church
will be filled with hearers who come there by preference. But in a
small and stationary society, in a congregation already made and not
specially attracted, yet by which he has to live, the clergyman finds
himself more the servant than the leader, less the pastor than the
thrall. He must 'suit,' else he is nowhere, and his bread and butter
are vanishing points in his horizon; that is, he must preach and
think, not according to the truth that is in him, but according to the
views of the most influential of his hearers, and in attacking their
souls he must touch tenderly their tempers.
These tempers are for the most part lions in the way difficult to
propitiate. The elementary doctrines of Christianity must be
preached of course, and sin must be held up as the thing to avoid,
while virtue must be complimented as the thing to be followed, and
a spiritual state of mind must be discreetly advocated. These are
safe generalities; but the dangers of application are many. How to
preach of duties to a body of men and women who have thrown off
every national and local obligation?—who have left their estates to
be managed by agents, their houses to be filled by strangers, who
have given up their share of interest in the school and the village
reading-room, the poor and the parish generally—men and women
who have handed themselves over to indolence and pleasure-
seeking, the luxurious enjoyment of a fine climate, the pleasant
increase of income to be got by comparative cheapness of
breadstuffs, and the abandonment of all those outgoings roughly
comprised under the head of local duties and local obligations?—
how, indeed? They have no duties to be reminded of in those moral
generalizations which touch all and offend none; and the clergyman
who should go into details affecting his congregation personally, who
should preach against sloth and slander, pleasure-seeking and
selfishness, would soon preach to empty pews and be cut by his
friends as an impertinent going beyond his office.
His congregation too, composed of educated ladies and gentlemen,
is sure to be critical, and therefore all but impossible to teach. If he
inclines a hair's breadth to the right or the left beyond the point at
which they themselves stand, he is held to be unsound. His sermons
are gravely canvassed in the afternoon conclaves which meet at
each other's houses to discuss the excitement of the Sunday
morning in the new arrivals or the new toilets. Has he dwelt on the
humanity underlying the Christian faith? He is drifting into
Socinianism; and those whose inclinations go for abstract dogmas
well backed by brimstone say that he does not preach the Gospel.
Has he exalted the functions of the minister, and tried to invest his
office with a spiritual dignity and power that would furnish a good
leverage over his flock? He is accused of sacerdotalism, and the
free-citizen blood of his listening Erastians is up and flaming. Does
he, to avoid these stumbling-blocks, wander into the deeper
mysteries and discourse on things which no man can either explain
or understand? He is accused of presumption and profanity, and is
advised to stick to the Lord's Prayer and the Sermon on the Mount.
If he is earnest he is impertinent; if he is level he is cold. Each
member of his congregation, subscribing a couple of guineas
towards his support, feels as if he or she had claims to that amount
over the body and soul and mind and powers of the poor parson in
his or her pay; and the claim is generally worked out in snippets, not
individually dangerous to life nor fortune, but inexpressibly
aggravating, and as depressing as annoying. For the most part, the
unhappy man is safest when he sticks to broad dogma, and leaves
personal morality alone. And he is almost sure to be warmly
applauded when he has a shy at science, and says that physicists
are fools who assert more than they can prove, because they cannot
show why an acorn should produce an oak, nor how the phenomena
of thought are elaborated. This throwing of date-stones is sure to
strike no listening djinn. The mass of the congregations sitting in the
English Protestant churches built on foreign soil, know little and care
less about the physical sciences; but it gives them a certain
comfortable glow to think that they are so much better than those
sinful and presumptuous men who work at bacteria and the
spectroscope; and they hug themselves as they say, each man in his
own soul, how much nicer it is to be dogmatically safe than
intellectually learned.
Preaching personal morality indeed, with possible private application,
would be rather difficult in dealing with a congregation not
unfrequently made up of doubtful elements. Take that pretty young
woman and her handsome roué-looking husband, who have come
no one knows whence and are no one knows what, but who attend
the services with praiseworthy punctuality, spend any amount of
money, and are being gradually incorporated into the society of the
place. The parson may have had private hints conveyed to him from
his friends at home that, of the matrimonial conditions between the
two, everything is real save the assumed 'lines.' But how is he to say
so? They have made themselves valuable members of his
congregation, and give larger donations than any one else. They
have got the good will of the leading persons in the sacred
community, and, having something to hide, are naturally careful to
please, and are consequently popular. He can scarcely give form and
substance to the hints he has had conveyed to him; yet his
conscience cries out on the one side, if his weakness binds him to
silence on the other. In any case, how can he make himself the
Nathan to this questionable David, and, holding forth on the need of
virtuous living, thunder out, 'Thou art the man!'? Let him try the
experiment, and he will find a hornet's nest nothing to it.
How too, can he preach honesty to men, perhaps his own
churchwardens, who have outrun the constable and outwitted their
creditors at one and the same time? How lecture women who flirt
over the borders on the week days, but pay handsomely for their
sittings on Sundays, on the crown with which Solomon endowed the
lucky husband of the virtuous woman? He may wish to do all this;
but his wife and children, and the supreme need of food and firing,
step in between him and the higher functions of his calling; and he
owns himself forced to accept the world as he finds it, sins and
shortcomings with the rest, and to take heed lest he be eaten up by
over-zeal or carried into personal darkness by his desire for his
people's light.
Sometimes the poor man is in thrall to some one in particular rather
than to his flock as a body; and there are times when this dominant
power is a woman; in which case the many contrarieties besetting
his position may be multiplied ad infinitum. Nothing can exceed the
miserable subjection of a clergyman given over to the tender
mercies of a feminine despot. She knows everything, and she
governs as much as she knows. She makes herself the arbiter of his
whole life, from his conscience to his children's boots, and he can
call neither his soul nor his home his own. She prescribes his
doctrine, and takes care to let him know when he has transgressed
the rules she has laid down for his guidance. She treats the hymns
as part of her personal prerogative, and is violently offended if those
having a ritualistic tendency are sung, or if those are taken whereof
the tunes are too jaunty or the measure is too slow. The unfortunate
man feels under her eye during the whole of the service, like a
schoolboy under the eye of his preceptress; and he dare not even
begin the opening sentences until she has rustled up the aisle and
has said her private prayer quite comfortably. She holds over his
head the terror of vague threats and shadowy misfortunes should he
cross her will; but at the same time he does not find that running in
her harness brings extra grist to his mill, nor that his way is the
smoother because he treads in the footsteps she has marked out for
him.
Sometimes she takes a craze against a voluntary; sometimes she
objects to any approach to chanting; and if certain recalcitrants of
the congregation, in possession of the harmonium, insist on their
own methods against hers, she writes home to the Society and
complains of the thin edge of the wedge and the Romanizing
tendencies of her spiritual adviser. In any case she is a fearful
infliction; and a church ruled by a female despot is about the most
pitiable instance we know of insolent tyranny and broken-backed
dependence.
But the clergymen serving these transmarine stations are not often
themselves men of mark nor equal to their contemporaries at home.
They are often sickly, which means a low amount of vital energy;
oftener impecunious, which presupposes want of grip and precludes
real independence. They are men whose career has been somehow
arrested; and their natures have suffered in the blight that has
befallen their hopes. Their whole life is more or less a compromise,
now with conscience, now with character; and they have to wink at
evils which they ought to denounce, and bear with annoyances
which they ought to resent. In most cases they are obliged to eke
out their scanty incomes by taking pupils; and here again the
millstone round their necks is heavy, and they have to pay a large
moral percentage on their pecuniary gains. If their pupils are of the
age when boys begin to call themselves men, they have to keep a
sharp look-out on them; and they suffer many things on the score of
responsibility when that look-out is evaded, as it necessarily must be
at times. As the characteristic quality of small societies is gossip, and
as gossip always includes exaggeration, the peccadilloes of the
young fellows are magnified into serious sins, and then bound as a
burden on the back of the poor cleric in thrall to the idle imaginings
of men and the foolish fears of women. One black sheep in the
pupilary flock will do more damage to the reputation of the unhappy
pastor who has them in hand than a dozen shining lights will do him
good. Morality is assumed to be the free gift of the tutor to the
pupil; and if the boy is bad the man is to blame for not having made
that free-gift betimes.
Look at it how we will, the clergyman in charge of these foreign
congregations has no very pleasant time of it. In a sense
expatriated; his home ties growing daily weaker; his hope of home
preferment reduced to nil; his liberty of conscience a dream of the
past; and all the mystical power of his office going down in the
conflict caused by the need of pew-rents, submission to tyrants, and
dependence on the Home Society, he lives from year to year
bemoaning the evil chances which have flung him on this barren,
shifting, desolate strand, and becoming less and less fitted for
England and English parochial work—that castle in the air, quiet and
secure, which he is destined never to inhabit. He is touched too in
part by the atmosphere of his surroundings; and to a congregation
without duties a clergyman with views more accommodating than
severe comes only too naturally as the appropriate pastor. The whole
thing proves that thraldom to the means of living, or rather to the
persons representing those means, damages all men alike—those in
cassock and gown as well as those in slop and blouse—and that lay
influence can, in certain circumstances, be just as tyrannical over the
clerical conscience as clerical influence is apt to be tyrannical over
lay living.
OLD FRIENDS.

We know all that can be said in laudation of old friends—the people


whose worth has been tried and their constancy proved—who have
come when you have called and danced when you have piped—been
faithful in sunshine and shadow alike—not envious of your prosperity
nor deserting you in your adversity—old friends who, like old wine,
have lost the crudity of newness, have mellowed by keeping, and
have blended the ripeness of age with the vigour of youth. It is all
true in certain circumstances and under certain conditions; but the
old friend of this ideal type is as hard to find as any other ideal;
while bad imitations abound, and life is rendered miserable by them.
There are old friends who make the fact of old friendship a basis for
every kind of unpleasantness. Their opinion is not asked, but they
volunteer it on all occasions, and are sure to give it in the manner
which galls you most and which you can least resent. They snub you
before your latest acquaintances—charming people of good status
with whom you especially desire to stand well; and break up your
pretensions of present superiority by that sledge-hammer of old
friendship which knows you down to the ground and will stand no
nonsense. The more formal and fastidious your company, the more
they will rasp your nerves by the coarse familiarity of their address;
and they know no greater pleasure than to put you in a false
position by pretending to keep you in your true place. They run in on
you at all times; and you have neither an hour undisturbed nor a
pursuit uninterrupted, still less a circumstance of your life kept
sacred from them. The strictest orders to your servant are ignored;
and they push past any amount of verbal barriers with the
irresistible force of old friendship to which nothing can be denied.
Whatever you are doing you can just see them, they say, smiling;
and they have neither conscience nor compassion when they come
and eat up your time, which is your money, for the gratification of
hearing themselves talk and of learning how you are getting on.
They do not scruple to ask about your affairs direct questions to
which you must perforce give an answer; silence or evasion
betraying the truth as much as assent; and they will make you a
present of their mind on the matter, which, though to the last degree
condemnatory, you are expected to accept with becoming gratitude
and humility.
If you have known them in your early boyhood, when you were all
uncivilized hail-fellows together, they refuse to respect your maturer
dignity, and will Tom and Dick and Harry you to the end, though you
sit in a horsehair wig on the bench, while your old friend, once your
class-mate of the country grammar school where you both got your
rudiments, is only a city clerk, badly paid and married to his
landlady's daughter.
To women this kind of return from the grave of the past is a dreadful
infliction and oftentimes a danger. The playfellows of the romping
hoydenish days dash home, bearded and bronzed, from Australia or
California; stride into the calm circle of refined matronhood with the
old familiar manner and using the old familiar terms; ask Fan or Nell
if she remembers this or that adventure on the mountain-side? by
the lake? in the wood?—topping their query by a meaning laugh as if
more remained behind than was expedient to declare. They slap the
dignified husband on the back, and call him a d——d lucky dog;
telling him that they envy him his catch, and would gladly stand in
his shoes if they could. It was all that cross-cornered cursed fate of
theirs which sent them off to Australia or California; else he, the
dignified husband, would never have had the chance—hey, Fan? And
they wink when they say it, as if they had good grounds to go on.
The wife is on thorns all the time these hateful visits last. She
wonders how she could ever have been on romping terms with such
a horror, even in her youngest days; and feels that she shall hate her
own name for ever, after hearing it mouthed and bawled by her old
friend with such aggressive familiarity. The husband, if jealous by
nature, begins to look sullen and suspicious. Even if he is not
jealous, but only reserved and conventional, he does not like what
he sees, still less what he hears; and is more than half inclined to
think he has made a mistake, and that the Fan or Nell of his bosom
would have been better mated with the old friend from the
backwoods than with him.
The old friends who turn up in this way at all corners of your life are
sure to be needy, and hold their old friendship as a claim on your
balance at the bank. They stick closer to you than a brother, and you
are expected to stick as close to them; and, as a sign thereof, to
provide for their necessities as so much interest on the old account
of affection still running. If you shrink from them and try to shunt
them quietly, they go about the world proclaiming your ingratitude,
and trumpeting forth their deserts and your demerits. They deride
your present success, which they call stuck-up and mushroom;
telling all the minor miseries of your past, when your father found it
hard to provide suitably for his large family, and their mother had
more than once to give yours a child's frock and pinafore in pity for
your rags. They generally contrive to make a division in your circle;
and you find some of your new friends look coldly on you because it
is said you have been ungrateful to your old. The whole story may
be a myth, the mere coinage of vanity and disappointment; but
when did the world stop to prove the truth before it condemned?
There is no circumstance so accidental, no kindness so trivial, that it
cannot be made to constitute a claim to friendship for life and all
that friendship includes—intimacy before the world; pecuniary help
when needed; no denial of time; no family secrets; unvarying
inclusion in all your entertainments; personal participation in all your
successes; liberty to say unpleasant things without offence and to
interfere in your arrangements; and the right to take at least one
corner of your soul, and that not a small one, which is not to be your
own but your old friends'. Have they, by the merest chance,
introduced you to your wife the beautiful heiress, to your husband
the good match?—the world echoes with the news, and the echoes
are never suffered to die out. It is told everywhere, and always as if
your happy marriage were the object they had had in view from the
earliest times—as if they had lived and worked for a consummation
which in reality came about by the purest accident. Have they been
helpful and friendly when your first child was born, or nursery
sickness was in your house?—you are bought for life, you and your
offspring; unless you have had the happy thought of making them
sponsors, when they learn the knack of disappearing from your
immediate circle, and of only turning up on those formal occasions
which do not admit of making presents. Did they introduce you to
your first employer?—your subsequent success is the work of their
hands, and they bear your fame on their shoulders like complacent
Atlases balancing the world.
They go about cackling to every one who will listen to them how
they got your first essay into print; how they mentioned your name
to the Commissioners, and how, in consequence, the Commissioners
gave you that place whence dates your marvellous rise in life; how
they advised your father to send you to sea and so to make a man
of you, and thus were the indirect cause of your K.C.B.-ship. But for
them you would have been a mere nobody, grubbing in a dingy City
office to this day. They gave you your start, and you owe all you are
to them. And if you fail to honour their draft on your gratitude to the
fullest amount, they proclaim you a defaulter to the most sacred
claims and the most pious feelings of humanity. You point the moral
of the base ingratitude of man, and are a text on which they preach
the sermon of non-intervention in the affairs of others. Let drowning
men sink; let the weak go to the wall; and on no account let any one
trouble himself about the welfare of old friends, if this is to be the
reward. Henceforth, you are morally branded, and your old friend
takes care that the iron shall be hot. There is no service, however
trifling, but can be made a yoke to hang round your neck for life;
and the more you struggle against it the more it galls you. Your best
plan of bearing it is with the patience which laughs and lets things
slide. If however, you are resolute in repudiation, you must take the
sure result without wincing.
To these friends of your own add the friends of the family—those
uncomfortable adhesives who cling to you like so many octopods,
and are not to be shaken off by any means known to you. They
claim you as their own—something in which they have the rights of
part-proprietorship—because they knew you when you were in your
cradle, and had bored your parents as they want to bore you. It is of
no use to say that circumstances are of less weight than character.
You and they may stand at opposite poles in thought, in aspiration,
in social condition, in habits. Nevertheless they insist on it that the
bare fact of longtime acquaintance is to be of more value than all
these vital discrepancies; and you find yourself saddled with friends
who are utterly uncongenial to you in every respect, because your
father once lived next door to them in the country town where you
were born, and spent one evening a week in their society playing
long whist for threepenny points. You inherit your weak chest and
your snub nose, gout in your blood and a handful of ugly skeletons
in your cupboard; these are things you cannot get rid of; things
which come as part of the tangled yarn of your life and are the
inalienable misfortunes of inheritance; but it is too bad to add family
friends whom of your own accord you would never have known; and
to have them seated as Old Men of the Sea on your neck, never to
be shaken off while they live.
In fact, this whole question of friendship wants revision. The general
tendency is to make it too stringent in its terms, and too indissoluble
in its fastenings. If the present should not make one forget the past,
neither should the past tyrannize over the present. Old friends may
have been pleasant enough in their day, but a day is not for ever,
and they are hurtful and unpleasant now, under new conditions and
in changed circumstances. They disturb the harmony of our
surroundings, and no one can feel happy in discord.
They themselves too, change; we all do, as life goes on and
experience increases; and it is simply absurd to bring the old
fashions of early days into the new relations of later times. We are
not the Tom, Dick, and Harry of our boyhood in any essential save
identity of person; neither are they the Bill and Jim they were. We
have gone to the right, they to the left; and the gap between us is
wider and deeper than that of mere time. Of what use then, to try to
galvanize the dead past into the semblance of vitality? Each knows
in his heart that it is dead; and the only one who wishes to galvanize
it into simulated life is the one who will somehow benefit by the
discomfort and abasement of the other. For our own part, we think
one of the most needful things to learn on our way through the
world is, that the dead are dead, and that silent burial is better than
spasmodic galvanism.
POPULAR WOMEN.

The three chief causes of personal popularity among women are, the
admiration which is excited, the sympathy which is given, or the
pleasure that can be bestowed. We put out of court for our present
purpose the popularity which accompanies political power or
intellectual strength, this being due to condition, not quality, and
therefore not of the sort we mean. Besides, it belongs to men rather
than to women, who seldom have any direct power that can
advance others, and still seldomer intellectual strength enough to
obtain a public following because of their confessed supremacy. The
popular women we mean are simply those met with in society—
women whose natural place is the drawing-room and whose sphere
is the well-dressed world—women who are emphatically ladies, and
who understand les convenances and obey them, even if they take
up a cause, practise philanthropy or preach philosophy. But the
popular woman rarely does take up a cause or make her
philanthropy conspicuous and her philosophy audible. Partizanship
implies angles; and she has no angles. If of the class of the admired,
she is most popular who is least obtrusive in her claims and most
ingenuous in ignoring her superiority. A pretty woman, however
pretty, if affected, vain, or apt to give herself airs, may be admired
but is never popular. The men whom she snubs sneer at her in
private; the women whom she eclipses as well as snubs do more
than sneer; those only to whom she is gracious find her beauty a
thing of joy; but as she is distractingly eclectic in her favouritism she
counts as many foes as she has friends; and though those who
dislike her cannot call her ugly, they can call her disagreeable, and
do. But the pretty woman who wears her beauty to all appearance
unconsciously, never suffering it to be aggressive to other women
nor wilfully employing it for the destruction of men, who is gracious
in manner and of a pleasant temper, who is frank and approachable,
and does not seem to consider herself as something sacred and set
apart from the world because nature made her lovelier than the rest
—she is the woman whom all unite in admiring, the popular person
par excellence of her set.
The popular pretty woman is one who, take her as a young wife
(and she must be married), honestly loves her husband, but does
not thrust her affection into the face of the world, and never flirts
with him in public. Indeed, she flirts with other men just enough to
make time pass pleasantly, and enjoys a rapid waltz or a lively
conversation as much as when she was seventeen and before she
was appropriated. She does not think it necessary to go about
morally ticketed; nor does she find it vital to her dignity nor to her
virtue to fence herself round with coldness or indifference to the
multitude by way of proving her loyalty to one. Still, as it is notorious
that she does love her husband, and as every one knows that he
and she are perfectly content with each other and therefore not on
the look-out for supplements, the men with whom she has those
innocent little jokes, those transparent secrets, those animated
conversations, that confessed friendship and good understanding, do
not make mistakes; and the very women belonging to them forget to
be censorious, even though this other, this popular woman, is so
much admired.
This popular woman is a mother too, and a fond one. Hence she can
sympathize with other mothers, and expatiate on their common
experiences in the confidential chat over five o'clock tea, as all fond
mothers do and should. She keeps a well-managed house, and is
notorious for the amount of needlework she gets through; and of
which she is prettily proud; not being ashamed to tell you that the
dress you admire so much was made by her own hands, and she will
give your wife the pattern if she likes; while she boasts of even
rougher upholstery work which she and her maid and her sewing-
machine have got through with despatch and credit. She gives
dinners with a cachet of their own—dinners which have evidently
been planned with careful thought and study; and she is not above
her work as mistress and organizer of her household. Yet she finds
time to keep abreast with the current literature of the day, and never
has to confess to ignorance of the ordinary topics of conversation.
She is not a woman of extreme views about anything. She has not
signed improper papers and she does not discuss improper
questions; she does not go in for woman's rights; she has a horror
of facility of divorce; and she sets up for nothing—being neither an
Advanced Woman desirous of usurping the possessions and
privileges of men, nor a Griselda who thinks her proper place is at
the feet of men, to take their kicks with patience and their caresses
with gratitude, as is becoming in an inferior creature. She does not
dabble in politics; and though she likes to make her dinners
successful and her evenings brilliant, she by no means assumes to
be a leader of fashion nor to impose laws on her circle. She likes to
be admired, and she is always ready to let herself be loved. She is
always ready too, to do any good work that comes in her way; and
she finds time for the careful overlooking of a few pet charities about
which she makes no parade, just as she finds time for her nursery
and her needlework. And, truth to tell, she enjoys these quiet hours,
with only her children to love her and her poor pensioners to admire
her, quite as much as she enjoys the brilliant receptions where she is
among the most popular and the most beautiful.
Her nature is gentle, her affections are large, her passions small.
She may have prejudices, but they are prejudices of a mild kind,
mainly on the side of modesty and tenderness and the quietude of
true womanhood. She is woman throughout, without the faintest
dash of the masculine element in mind or manners; and she aspires
to be nothing else. She carries with her an atmosphere of happiness,
of content, of spiritual completeness, of purity which is not prudery.
Her life is filled with a variety of interests; consequently she is never
peevish through monotony, nor yet, on the other hand, is she
excited, hurried, storm-driven, as those who give themselves up to
'objects,' and perfect nothing because they attempt too much. She is
popular, because she is beautiful without being vain; loving without
being sentimental; happy in herself, yet not indifferent to others;
because she understands her drawing-room duties as well as her
domestic ones, and knows how to combine the home life with social
splendour. This is the best type of the popular pretty woman to
whom is given admiration, and against whom no one has a stone to
fling nor a slander to whisper; and this is the ideal woman of the
English upper-class home, of whom we still raise a few specimens,
just to show what women may be if they like, and what sweet and
lovely creatures they are when they are content to be as nature
designed them.
Another kind of popular woman is the sympathetic woman, the
woman who gives instead of receiving. This kind is of variable
conditions. She may be old, she may be ugly; in fact, she is more
often both than neither; but she is a universal favourite
notwithstanding, and no woman is more sought after nor less
wearied of, although few can say why they like her. She may be
married; but generally she is either a widow or an old maid; for, if
she be a wife, her sympathies for things abroad are necessarily
somewhat cramped by the pressure of those at home;—and her
sympathies are her claim to popularity. She is sincere too, as well as
sympathetic, and she is safe. She holds the secrets of all her friends;
but no one suspects that any before himself has confided in her. She
has the art, or rather the charm, of perpetual spiritual freshness, and
all her friends think in turn that the fountain has been unsealed now
for the first time. This is not artifice; it is simply the property of deep
and inexhaustible sympathy. It is not necessary that she should be a
wise adviser to be popular. Her province is to listen and to
sympathize; to gather the sorrows and the joys of others into her
own breast, so as to soften by sharing or heighten by reduplication.
Most frequently she is not over rigid in her notions of moral
prudence, and will let a lovesick girl talk of her lover, even if the
affair be hopeless and has been forbidden; while she will do her best
to soothe the man who has had the misfortune to get crazed about
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like