Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (5 votes)
17 views

SQL Server Database Programming With Visual Basic NET Concepts Designs and Implementations Ying Bai - The ebook in PDF format is ready for immediate access

The document provides information about various eBooks available for download on textbookfull.com, focusing on SQL Server Database Programming and related topics. It includes links to specific titles, authors, and descriptions of the content covered in each book. Additionally, it outlines the structure and features of the book 'SQL Server Database Programming with Visual Basic.NET' by Ying Bai, detailing its chapters and key concepts in database programming.

Uploaded by

krecikweiyan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (5 votes)
17 views

SQL Server Database Programming With Visual Basic NET Concepts Designs and Implementations Ying Bai - The ebook in PDF format is ready for immediate access

The document provides information about various eBooks available for download on textbookfull.com, focusing on SQL Server Database Programming and related topics. It includes links to specific titles, authors, and descriptions of the content covered in each book. Additionally, it outlines the structure and features of the book 'SQL Server Database Programming with Visual Basic.NET' by Ying Bai, detailing its chapters and key concepts in database programming.

Uploaded by

krecikweiyan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 55

Explore the full ebook collection and download it now at textbookfull.

com

SQL Server Database Programming With Visual Basic


NET Concepts Designs and Implementations Ying Bai

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

OR CLICK HERE

DOWLOAD EBOOK

Browse and Get More Ebook Downloads Instantly at https://textbookfull.com


Click here to visit textbookfull.com and download textbook now
Your digital treasures (PDF, ePub, MOBI) await
Download instantly and pick your perfect format...

Read anywhere, anytime, on any device!

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/
textbookfull.com

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/
textbookfull.com

Programming with Microsoft Visual Basic 2017 Diane Zak

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

textbookfull.com

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/

textbookfull.com
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/

textbookfull.com

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/
textbookfull.com

Programming with Microsoft Visual Basic 2015 7th Edition


Diane Zak

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

textbookfull.com

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/
textbookfull.com

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/
textbookfull.com
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.


Another Random Document on
Scribd Without Any Related Topics
Ragusan goods were transported either wholly by sea round
Sabbioncello or via Stagno to the little island of Osinj in the river
delta, where a trading depôt was opened. Close by were several
other depôts, the most important of which was the Forum Narenti
(called Driva by the Slaves), with a large customs station, salt stores,
and a Ragusan colony. Later it was supplanted by the Venetian
castle of Gabela or Gabella.228 The caravans travelled from the
mouth of the Narenta through the land of Hlum, following the course
of the river to Blagaj, the residence of the lords of Hlum (afterwards
Dukes of St. Saba or the Herzegovina), above the spot where the
river Buna springs full-grown from the rocks.229 The route continued
up the Narenta valley, as the railway does to-day, past Konjica,
which was to play an important part in later times, over the Ivan
Pass to Visoko in the centre of Bosnia, the castle of the Bani. Below
was the town of Podvisoko (Sotto-Visochi in Ragusan documents),
on the banks of the river Bosna. Between 1348 and 1430 this was
the commercial capital of the country and the seat of important
trading communities. From Visoko the route proceeded to Olovo and
Borač, near Vlasenica,230 where it branched off into three. One led
eastward to Srebrnica, the centre of the silver-mining district,231 and
Rudnik; another went northwards to Soli; the main route went to
Kučlat, well known as a trading station in the fourteenth century,
with a large Ragusan colony, to Zvornik and across the Drina to
Sirmia and Belgrad. At Sirmia,232 which was on the ruins of the
Roman Syrmium, the Ragusans had a flourishing settlement
protected by the Kings of Hungary, until the town was burnt by the
Turks in 1396. Its importance was due to its position as a starting
point for the Ragusan traders going to all parts of Hungary.233
These various routes were called collectively the Via de Bossina in
the Ragusan documents. The routes which started from the coast at
points south of Ragusa were denominated the Via de Zenta.234
Ragusan vessels sailed down the coast, and either discharged their
goods at the towns of Antivari and Dulcigno, or sailed for some
distance up the various rivers—the Bojana, the Drim, the Mat, the
Išmi, the Vrego, the Devol, and the Vojussa. This stretch of coast,
which had formed part of the Byzantine theme of Dyrrhachium, was
under Servian rule from 1180 to 1440.
“In Servian times,” writes Prof. Jireček,235 “this region, now so
desolate, was in the most flourishing condition, and had a large
population and numerous beautifully situated towns. Even in the
sixteenth century Italian travellers who ascended the course of the
Bojana compared this green land with its many villages to their own
fair country. Large Latin and Oriental monasteries stood peacefully
side by side. Servian, Albanian, and Italian were the principal
languages spoken. The cities enjoyed important privileges, granted
by the Servian Kings, Tsars, and Despots (later by the Balšići), and
their citizens occupied important positions in the Government
service; the ruling princes themselves often visited these districts.
The ports plied a busy trade, for from hence goods were transported
to the Byzantine districts of Macedonia and Thrace, as far as
Bulgaria and the Mare Majus (Mar Maggiore) as the Italians in the
Middle Ages called the Black Sea.”
The chief city off the coast of Zedda was Antivari, situated about
four miles from the sea, where the open bay of Volovica served as a
harbour. Its government, like that of Ragusa and Cattaro, was an
oligarchical constitution, in the hands of a numerous and active
aristocracy, under privileges granted by the Servian Tsars. The
citizens were of Latin origin, and Latin and Italian were the official
languages, but the inhabitants of the surrounding country were
Serbs. It was the centre of the archiepiscopal see of Northern
Albania. After the Turkish conquest its importance was reduced to
nil, and nearly all the noble families either died out or emigrated to
Ragusa. It is not easy to realise that the actual Montenegrin village
was once a busy commercial city. Nothing but a few escutcheons on
some of the houses bear witness to its past magnificence.
A few miles farther south is Dulcigno,236 which was also an
autonomous oligarchical Republic, albeit less important than Antivari.
Here the Roman element was always mixed with the Albanian. After
the Turkish conquest it became a nest of pirates. Close by was the
Golfo dello Drino, into which the two rivers Bojana and Drim (Drino)
flowed. Eighteen miles up the course of the former was the great
Benedictine monastery of San Serge and St. Bacchus, round which
stood warehouses, customs offices, salt stores, shops, and booths,
forming a centre called San Sergio by the Italians, Sveti Srgj by the
Serbs; it retained its importance until the sixteenth century.237 At
the time of Queen Helena, the widow of Stephen Uroš I., the
settlement was under a “Bajulus Regine at Portum Sancti Sergii.”238
Here the ships unloaded their cargoes, which were forwarded to all
parts of the interior by caravan; goods designed for Scutari,
however, were sometimes transhipped into smaller boats and thus
carried up to the lake and town. The caravan route went past Scutari
to the castle of Danj (now Daino) on the Drim, where the Servian
kings sometimes resided, and where the route joined that from
Alessio (Lissos, Alexium, Slav- and Alb-Lješ239) at the mouth of the
Drim. Thence the caravans proceeded to Prizren, which they reached
in thirty-three hours by a road reputed to be one of the most difficult
in the Albanian mountains.240 The chief halting-places were Pilot
and Spas, where there was a custom house. Prizren, which is on the
Bistrica, some distance east of the junction of that river with the
White Drim, is still a large town, on the site of the Roman
Therenda.241 Nemanja conquered it from the Eastern Empire; in
1204 it was in Bulgarian hands; in the course of the century it came
once more into Servian possession, and was one of the chief cities of
the kingdom. King Milutin and the Tsars Dušan and Uroš frequently
made it their residence, and many ruined castles are found in the
vicinity. Here was the chief commercial factory of the Ragusans for
Albania, and they erected two Latin churches. From Prizren the
routes crossed a fertile and well-populated plain, over the watershed
between the Adriatic and the Black Sea, and into the plain of
Kossovo. At Lipljan (Ulpiana and Justiniana Secunda in Roman times)
it crossed the route from Bosnia to Salonica, reached Novobrdo, and
finally Sofia, one of the Bulgarian capitals. The first mention of a
Ragusan merchant in this city is in 1376; the Ragusan colony
became very important at the end of the century in Turkish times,
when Sofia was the residence of the Beglerbeg of Rumelia.242
The second Via de Zenta started from the three harbours of Antivari
via the Sutorman Pass, Budua by the bridle path to Cetinje (still in
use), and Cattaro by the road to Cetinje. A little further east the
three branches met, and the route proceeded over well-wooded
mountains, now, alas, bare and desolate, past the ruins of Doclea to
Podgorica (a day and a half from Cattaro); then to the Plava lake,
one of the fairest spots in Albania, but now also one of the most
dangerous, on the shores of which, according to Professor Stojan
Novaković, stood the well-known Servian trading centre of Brskovo.
Professor Jireček, however, who has had access to further materials,
places it in the upper Lim valley. Brskovo (Brescoa or Brescoua in
Venetian and Ragusan documents) was the chief commercial city of
Servia, and is mentioned as early as the days of King Stephen the
First-Crowned (1196-1228). It was principally frequented by the
people of Ragusa and Cattaro, and to a lesser extent by the
Venetians. The various products of the districts were collected here
for export to the coast, while the caravans from the coast brought
foreign goods for distribution throughout Servia. The customs, which
were usually farmed out to Ragusans, were a source of considerable
revenue to the Servian kings. Here, as in some other mining towns,
was also a mint, where the grossi di Brescova were coined.243 The
Ragusan colony was numerous and influential, containing members
of some of the noblest families.244 Beyond Brskovo came Peč (Ipek
in Turkish), an archiepiscopal, and later patriarchal, see (until 1766).
Peč, too, enjoyed considerable traffic, and had a Ragusan colony in
the fourteenth century.
The post from Venice to Constantinople went by this route in the
sixteenth century. As soon as the ship arrived the despatches were
handed to the messengers (they were always natives from two
Montenegrin villages), who rode off with them via Plava, Peč,
Novoselo, Priština, Samokov, and Philippopolis, reaching the
Bosporus in eighteen days.245
Throughout Servia, Bosnia, Hlum, the Zeta, and Bulgaria there were
thus numerous Ragusan colonies. As a rule mining was the chief
industry, and it was in the mining districts that the commercial
settlements were to be found. In Roman times the mines of Illyria
were well known; they were abandoned at the time of the barbarian
inroads, and it was not until the twelfth and thirteenth centuries, at
the time of the rise of the Serb States, that the industry revived.
Wonderful tales were told by mediæval travellers of the richness of
the Balkan mines. As late as 1453 the Greek Critobulus asserted that
gold and silver sprang from the earth like water, and that wherever
you dug you found large deposits of the precious metals, in greater
quantities than in the Indies.246 King Stephen Uroš II. Milutin (1282-
1320) was the first to summon in German miners, called Sasi (i.e.
Saxons), so as to benefit by their superior skill, but the Ragusans
were also numerous. Many of the technical terms relating to mining
still used in Bosnia are of German origin: orat = Ort; hutman =
Hüttenmann; karan = Karren. The ore was extracted from galleries
and shafts, many of which are still in existence. The refining of the
metal was executed at Ragusa or Venice.
Gold, silver, lead, and iron were the chief products of the Bosnian
and Servian mines. Gold, of which the earliest mention is in 1253,
was found chiefly in the neighbourhood of Novobrdo (Novus Mons,
Nouomonte, Νοβοπύργον), which was for a long time the largest city
in the interior of the Balkan peninsula between the plain of Kossovo
and the Bulgarian Morava, three miles east of Priština. Silver,
however, was found in much larger quantities. Of this metal two
kinds are mentioned in the Ragusan annals, i.e. argento bianco
(white silver) and argento de glama (glamsko srebro in Slavonic),
which had a slight gold alloy. Srebrnica was the chief centre for the
silver-mining industry. Lead was another important product, and was
in much request for the roofing of houses and churches. Sometimes
a whole caravan of 300 horses journeyed from the mining districts to
Ragusa laden with nothing but lead. The iron output gave rise to
various active industries, both locally and at Ragusa, where Bosnian
iron-workers were often employed by the Republic. A certain amount
of copper was also found, and there were tin and quicksilver mines
in the Kreševo district. The principal mining centres thus were:
Kreševo and Fojnica;247 Srebrenica, near the Drina, chiefly for
silver;248 Zvornik on the Drina, for lead;249 Rudnik, where there are
traces of Roman mines mentioned by Ragusan documents of the
thirteenth century; Kopaonik, for silver and iron;250 Novobrdo, for
gold and other metals;251 Kučevo and Brskovo, which flourished at
the end of the thirteenth century.252
Each mining centre usually consisted of a castle on a hill, wherein
dwelt the Vojvod, or feudal lord, representing the King or Tsar, and a
town below with a market, where the miners and merchants dwelt.
In times of danger the whole community could take shelter in the
castle.253 The Saxons, as we have seen, were the most numerous of
the foreign settlers, and the Ragusans came immediately after them.
At Novobrdo early in the fifteenth century we find members of nearly
all the noblest Ragusan families—Bobali, Benessa, Menze, Ragnina,
Resti, Gozze, Caboga, &c. The Ragusans were the principal
merchants and carriers, and the provision trade was almost wholly in
their hands. They sold supplies in exchange for raw metal. There
were also merchants from the other Dalmatian towns, from Italy,
especially from Venice, and a few natives. The mining towns on the
whole had a marked Latin character, and they were all provided with
at least one Latin church,254 under the authority of the Bishop of
Cattaro. There were also several Franciscan monasteries, which
afterwards ministered to the religious needs of the native Catholics
in Turkish times; some of them still exist. The chief authority in the
town was, as I have said, the Servian Vojvod, but the head of the
mining and mercantile community was the Conte dei Purgari
Vaoturchi.255 The taxes and customs were farmed to Ragusan or
Cattarine speculators, and in fact most of the higher financial
officials in the South-Slavonic States, including the Protovestiars
(Finance Ministers), were usually natives of those cities. The
Ragusans who owned houses were bound to bear arms in defence
of the castle and market-town, but the others were exempt. If a
dispute arose between them and the Saxons or the Serbs the
question was decided by an arbitration commission composed of six
Ragusans and six Saxons or Serbs. Ragusan creditors enjoyed the
privilege of being able to imprison their debtors, provided they too
were Ragusans, in their own houses. The heads of the Ragusan
community were the consul and two judges, usually noblemen
appointed by the Republic. In 1332 a consul was appointed to reside
at the Royal Court, which was at Prizren or Skopje (Üsküb).256 This
consul was to travel about the country, visiting all the market-towns,
mining centres, and fairs, with a view to learning what openings
there were for Ragusan trade, as well as all the towns where
Ragusan colonies were already established. The different mints were
under the superintendence of the Vojvods and of the gabellotti (tax-
farmers) or aurifices (goldsmiths), usually Ragusans or Dalmatians.
In the tenth century Constantine Porphyrogenitus alludes to the use
of coinage by the Ragusans, but for a long time afterwards trade
continued to be carried on by means of barter. Thus in 1280 we find
a Ragusan selling a horse to a fellow-citizen for sixteen ells of cloth,
and even as late as 1322, although mints were established in various
places, a commercial treaty between Stephen, Banus of Bosnia, and
Ragusa alludes to the fact that cattle were used for payments of
indemnities.257
Communications between Ragusa and the settlements in the interior
were carried on by means of couriers (cursores, corrieri, Slav.
knižnici), who were instituted early in the fourteenth century, and
lasted until the fall of the Republic. They carried official
correspondence from the Republic to the ambassadors and consuls,
and legal notices, writs, reports of judicial proceedings, &c., to the
Ragusan traders. They were not allowed to convey private
correspondence, which was usually sent by caravan, or in the case
of the chief merchants by their own special messengers, save on the
return journey. The time employed by these official messengers was
usually two days from Ragusa to Blagaj (Mostar), four or five to
Visoko or Sutieska, five or six to Prača, seven or eight to Srebrnica,
ten to Zvornik, twelve to Syrmium, seven to Rudnik or Novobrdo,
fifteen to Constantinople. In bad weather, when the passes were
blocked with snow, double the time was often necessary to traverse
the same distance, which was the time required by the caravans in
favourable weather. The envoys sent to Constantinople with the
tribute to the Sultan took as much as two months.258 The official
correspondence to the various Ragusan representatives in the East is
preserved in the archives of Ragusa in 138 volumes, under the
heading of Lettere e Commissioni di Levante.
This traffic proved to be a source of great wealth for the citizens,
who in time came almost to enjoy a monopoly of the inland trade in
this part of the Balkan peninsula. But great as were the privileges
which they enjoyed, merchants and miners were subject to
depredations and arbitrary confiscations at the hands of the Servian
kings, the Bosnian Bani, or the various minor feudatories. Most of
the quarrels between Ragusa and the Slavonic States were caused
by these depredations, which after all were natural enough. The
Ragusan merchants succeeded in accumulating large fortunes by
intelligent management and indefatigable industry, which the less
hard-working Slaves, devoted to the arts of war, were incapable of
acquiring. Whenever the King or vassal lord was in need of money,
what could be simpler than to pounce down upon a richly-laden
caravan on its way to or from the coast and plunder it or take heavy
toll of it, or to impose fresh taxes on the wealthy colonies of
“Uitlanders” at Rudnik, Srebrnica, or Brskovo? Ragusa was often
forced to pay tribute to this or that sovereign to ensure safety from
depredation, and in those days the line of division between
feudalism and brigandage was very vague. But the mercantile
communities were quite willing to undergo the risks for the sake of
the large profits which they made. There can be no doubt that in
this way a certain amount of civilisation was introduced into these
lands which would otherwise have remained quite without the pale.
The currents of western thought and culture found their way into
Bosnia and Servia by way of Ragusa and the other Dalmatian towns
rather than by Constantinople.259 These civilising influences
increased and spread until the curse of the Turkish conquest fell on
the land like a blight, from which it is only now beginning slowly and
painfully to recover.
This mercantile development naturally led to the formation of
numerous guilds or confraternities. Like other Ragusan institutions,
they were based on Venetian models, and were really the beginnings
of the modern mutual aid societies on a religious groundwork.
Among the earliest of these are that of the joiners, founded in 1266;
that of St. Michael, founded in 1290; that of the goldsmiths (1306),
that of Rosgiato (1321), and that of St. Anthony the Abbot (1348).
During the Venetian period they were under strict Government
supervision, but after 1358 they were invested with political
privileges and exemptions.260
CHAPTER VI

ART IN THE THIRTEENTH AND FOURTEENTH CENTURIES

D
URING the Venetian period, with the increasing wealth and
consequence of Ragusa, the city itself was beautified by the
erection of numerous handsome buildings, both lay and
ecclesiastical, and by 1358 it was almost entirely reconstructed. In
its early days the walls, the castle, and one or two churches were
the only stone edifices; all the rest of the town was of timber.
Throughout the thirteenth and fourteenth centuries the defences
were increased, new bastions erected, and the older walls
strengthened. The city now occupied both the seaward ridge and the
slopes of Monte Sergio. The walls by which it was surrounded
climbed painfully over the rocky eminences on each side, and
dropped down almost to the sea-level in between. The fortifications
did not acquire their present aspect until the sixteenth century, but
parts of them were begun much earlier. Four towers were erected at
the entrance of the harbour on the south-east side of the town, of
which two—San Luca and San Giovanni—still survive. The latter,
which is now called the Forte Molo, a huge round bastion, has been
considerably altered in later times; San Luca has preserved more of
its original character. Of the tower called the Campana Morta (the
dead bell),261 few traces beyond the name survives. The sea-tower
which occupies its site is evidently of a much later date. These
towers were garrisoned by the town guard of 127 men, who were
chosen by lot from the citizens every month, and increased in times
of danger.262 Other towers were built at intervals along the walls,
and their defence was entrusted to the private families whose
houses they adjoined. Of these the most important was the Torre
Menze or Minćeta, one of the most beautiful features of the city. Its
erection was decreed on July 3, 1319, but it was entirely rebuilt in
the fifteenth century, and considerably altered in the sixteenth. It
stands on one of the highest points of the town on the Monte
Sergio.
Of the other buildings of this time there are some important
remains, from which we may resume a fair idea of Ragusan
architecture under the Venetians. Its characteristic note at all times
is the fact that early forms were preserved here, as in other parts of
Dalmatia, down to a much later date than in the rest of Europe. The
style is a mixture of Italian with an Oriental touch, and occasionally,
according to Mr. Jackson, even a German element. During the
Venetian age traces of Byzantine art still survive, and in buildings of
the fourteenth century, a time when Italian Gothic was most
flourishing, we find the round arch of Romanesque art. But Ragusan
builders did not follow any very distinct system. The various styles
were no more than tapped by them. None were fully developed; and
in every building, from whichever point of view we regard it, we find
many deviations from strict orthodoxy. Some of the Ragusan
architects and master-masons had been educated in Italy, others
perhaps at Constantinople, but no part of their work shows an
absolute grasp over any definite style. Nevertheless it is extremely
interesting, and proves them by no means deficient in artistic sense.
Many of the buildings of this little Republic are of great beauty, and
the whole ensemble of edifices compares favourably with many a
more famous Italian town.
The principal buildings erected or completed between 1200 and
1350 are the following: The cathedral church of Santa Maria (1206-
1250), San Biagio (1348), the church and monastery of the
Franciscans (begun 1319), the Dominican church and monastery
(1254-1306), the Castello (1350, on the site of an earlier building),
and the Sponza or custom house, begun early in the fourteenth
century. The cathedral was destroyed by the earthquake of 1667,
San Biagio by fire in 1706, the Castello supplanted by another
building in 1388. The Franciscan and Dominican churches were
almost entirely rebuilt in later times, but of their monasteries much
remains, and the cloisters are in their original state. The Sponza,
too, survives, although the top story, the façade, and the portico
were added subsequently.
What the Duomo was like we can only discover from the somewhat
confused account of De Diversis, and from the model of the town in
the hands of the silver statuette of San Biagio. According to local
tradition, it was erected through the munificence of Richard Cœur-
de-Lion, King of England, who on returning from the Holy Land
encountered a terrible storm off Corfu, and made a vow that he
would build a church to the Virgin on the spot where he should first
touch land in safety. After being tossed
about for several days he was able to land
on the island of Lacroma, near Ragusa. In
fulfilment of his vow he built the church, at
the request of the citizens, in Ragusa itself,
as well as a small chapel on the island.
There is, however, no evidence of the truth
of this story, and none of the contemporary
accounts of Richard’s peregrinations even
mention Ragusa, while the entries in the
Ragusan archives state that the church was
built with the contributions of the nobles.
According to De Diversis, it was the most
CAPITAL IN THE
beautiful church in Dalmatia. It consisted of
FRANCISCAN CLOISTER
a nave and side aisles separated by great
columns; and from the above-mentioned model of the city we see
that it had a cupola mounted on a drum pierced with windows and a
clerestory. De Diversis also speaks of a curious ambulatory formed
by small columns outside the church, the walls of which were
ornamented with figures of animals. In the choir was the high altar,
with a pala of silver under a beautiful ciborium supported on four
pillars. The floors were of mosaic, and the windows all filled with
stained glass. On the walls were depicted scenes from the Old
Testament and the New. All this bespeaks a Romanesque building
with traces of Byzantine art. But alas! nothing remains of this
exquisite piece of architecture; the present church (1671-1713) is a
large classical edifice with barocco
ornamentation.
The original church of San Biagio was
begun in 1348 as a votive offering after the
plague of that year. From De Diversis’s
description it was very similar to the
Duomo, but on a smaller scale. It suffered
little damage from the earthquake, but was
burnt down in 1706. Both this church and
the Duomo are fairly good examples of an
unattractive style, and the stone of which
CAPITAL IN THE
they are built is of a rich mellow tone.
FRANCISCAN CLOISTER
The two stately piles at each end of the
town—the Franciscan and Dominican monasteries—have fortunately
preserved much of their original character. The latter was begun
after the destruction of the first Franciscan house outside the Porta
Pile by the Slaves in 1319, and the new building was erected just
within the gate, which its inmates were to guard in times of danger.
The church and a large part of the monastery have been rebuilt
since the earthquake, although here and there a few interesting
details remain. Thus on the south side, opening on to the Stradone,
there is a handsome doorway in the Venetian Gothic style,
surmounted by a Pietà, a very fair piece of sculpture; the date is
probably the end of the fifteenth century. In the sacristy we find a
Renaissance lavabo of carved stone. The campanile marks the
transition from the Romanesque to the Gothic. The east window of
the lower story and those on the second story are Venetian Gothic,
while the south window of the lower story is round-arched. The top
story with the cupola was rebuilt after the earthquake. But it is in
the cloister that the chief interest of the building lies, a cloister
which Mr. T. G. Jackson calls “one of the most singular pieces of
architecture I have ever seen.”263 Here we observe the most notable
feature of Dalmatian architecture in all its force, for although its date
is later than 1319 it is thoroughly Romanesque in character, and all
the arches are round. It consists of a courtyard with three bays
opening out into it on each side; the openings are divided into six
round-headed lights, each head being pierced by a large circular
light. A series of coupled octagonal shafts standing one behind the
other, with a common base and common abacus, but separate
capitals, serve as mullions to the arches. The capitals are extremely
quaint and curious. Each one is different from its fellows, and the
architect seems to have let his fancy run riot in designing them,
“recalling the wildest and most grotesque fancies of early
Romanesque work.”264 Some are adorned with simple foliage, spiral
volutes, and block leaves, but on others we find hideous grinning
faces, dragons, strange uncouth monsters, masks, dogs, and all
manner of fanciful ornaments. Judged by ordinary standards, we
should take them to be work of the twelfth or thirteenth century, but
as a matter of fact they are of a much later date. According to
Eitelberger, these early forms were preserved in most of the
monasteries of the East when they had given place to Gothic in
Western Europe.265 The workmanship of these capitals, like much
Ragusan carving, is somewhat rough and unfinished, but for this the
material, which is not sufficiently hard, may be partly responsible. Of
the open circles in the heads of the opening, the centre one on each
side of the cloister is larger, and ornamented with a rich border of
acanthus leaves; the others are cusped. Possibly it was intended that
they should all contain some ornamentation, and indeed the large
round openings look somewhat bare. Above the cloister is an elegant
balustrade, of which only one side survived the earthquake, but a
few years ago it was restored according to the original design. The
name of the architect has been preserved in an inscription in the
cloister itself:
☩ S · DE · MAGIST
ER MYCHA PETRAR
DANTIVAR QVIPPE
CITCLAVSTRVM
CVM OMNIBVS SVIS.
He was one Mycha of Antivari, a town where Byzantine influence
was stronger than at Ragusa. The inscription has no date, but it is
close to two others of 1363 and 1428, and the style of the lettering,
according to Jackson, is even earlier than 1363. The building was
not begun until after 1319, when the former Franciscan monastery
was destroyed, so that the date is somewhere between 1319 and
1363. Within the enclosure are orange trees and evergreen shrubs,
and a graceful little fountain is placed in the centre; the whole scene
forms a most charming picture of mediæval monastic life. A second
cloister higher up the hillside served as a garden where the simples
for the monks’ pharmacy were grown. This, too, is a delightful old-
world nook.
At the opposite end of the town, just inside the Porta Ploce, stands
the massive group of the Dominican church and monastery. These
buildings originally formed the southern bulwark of the town, the
monks themselves, like the Franciscans, being entrusted with the
defence of the gate; but later a second wall was built outside it. The
church, which was begun in 1245 and completed in 1360, consists of
a vast nave separated from a polygonal choir by a high arch. The
building is extremely bare; the traces of Gothic arches and clustered
pillars form a sort of skeleton, around which the existing church was
constructed in the seventeenth century. In the sacristy there are a
few more fragments of early work, and the south doorway, with a
round arch of many receding orders under an ogee crocketed hood
mould, also belongs to the original church. Jackson notices a strong
flavour of German Gothic in it. There are several pointed windows of
extreme simplicity, and a large round one decorated with an outside
frill of small Venetian arches. The campanile was begun in 1424266
by Fra Stefano, a Dominican, but it was not completed in 1440, for
De Diversis says of it, “nondum perfectum, in dies crescit.” It has
round arches and shafts set back to the centre of the wall.
But as in the Franciscan monastery, the cloister is almost untouched.
It is an irregular square, with five bays on each side, each bay being
divided by three lights, the head pierced by two irregular lights
above. The style is a curious medley “of Gothic and Renaissance, of
forms understood and otherwise, as indeed could only occur in a
land which, being on the borders of Eastern and Western culture, did
not possess the power to create and execute the various styles
correctly.”267 The arches of the bays are round, but the inside work
has more the character of Venetian Gothic, especially in the foliage.
The shield of the semicircular head is pierced by quatrefoil lights
encircled alternately with an ornament of interlacing circles almost
Byzantine in character. The Dalmatian architect had doubtless seen
Gothic work in Italy, but “had failed to grasp the idea of receding
orders in the arch, or consistent mouldings in his tracery.”268 The
columns with their caps and bases are of a severely antique
character. But in spite of all deviations from architectural orthodoxy
this cloister, set off by cherry and orange trees and evergreen
shrubs, is, after the Franciscan cloister, one of the loveliest monastic
buildings in Dalmatia.
The secular buildings, with one notable exception, belong to a later
period. The exception is the Sponza269 or custom house, a large part
of which was built in the early fourteenth century. It stands at the
end of the Stradone, opposite the Piazza and the church of San
Biagio, and consists of three stories built round a courtyard. The
ground floor and first floor were probably built in the first years of
the thirteenth century.270 The top story, the façade, and the portico
belong to the fifteenth and sixteenth centuries. The oblong courtyard
is surrounded on the lower story by vaulted arcades of round arches
with square soffits supported on short plain solid octagonal columns,
without bases (like those of the Ducal Palace at Venice), and short
capitals opening out into square abaci. The second story is also
arcaded, and has twice as many window openings as the lower story
has arches, round at the two ends and pointed on the sides, with
square piers over the columns below and round columns over the
centres of the arches; their capitals are adorned with foliage, some à
crochet, and some with deflected leaves at the angles. According to
Jackson, all this part is of the same period, in spite of the fact that
some of the openings are round and some pointed. The general
effect is one of extreme simplicity and sobriety; it is, as Jackson says
truly, “an admirable piece of plain, useful, and not ungraceful
architecture, not too showy for the commonplace purposes of the
building, and yet well proportioned and carefully built.”271 Round the
courtyard are the various warehouses, over the doors of which are
the names of different saints. Above the end arch is the inscription:

FALLERE NRA VETANT ET FALLI PONDERA MEQ.
PONDERO CVM MERCES PONDERAT IPSE DEVS.

The early work ends with the moulded stringcourse above the
second story; the third story, which has plain square windows, bears
the date 1520 and the monogram , found on so many houses in
Ragusa, to commemorate the earthquake of that year. The façade
has a portico of five handsome round arches in the Renaissance
style, the columns of which are adorned with elaborate capitals;
many of these have been renewed. Above is a row of windows in the
purest Venetian style of the fifteenth century. The central window is
a three-light aperture, the two side ones are of a single light. The
windows of the third story are square like those looking on the
courtyard. In the centre is a niche with a statue of St. Blaize, while
the row of pinnacles on the roof call to mind many a Venetian
palazzo. In spite of all incongruities the Sponza is a very attractive
building, full of quaint grace and good work.
It has many interesting associations with Ragusan history. It was
here that the caravans about to start on their perilous journeys
through the wild Balkan lands formed up, and those which arrived at
Ragusa first stopped. Every bale of goods arriving at or departing
from the city, by sea or land, had to be first examined at the Sponza,
where the proper amount of duty was assessed and paid. All
business was transacted at or around this building. To this day it
serves as a custom-house, and still forms a picturesque background
for the crowds of peasants and traders from all parts of Dalmatia,
the Herzegovina, Montenegro, and Albania who congregate here on
market days, although the traffic has declined both in bulk and in
value since the palmy days of the Republic. The first floor was used
in later years for literary and learned societies and entertainments.
The second floor was the mint.
Of the Castello no traces now remain, its place having been taken by
the Rector’s Palace, with which we shall deal later on. The buildings
we have described were almost the only stone edifices in the town.
All the rest, including the convent of the Clarisse, founded in 1290,
were of timber.272 Ragusa was in great part destroyed by fire in
1292, and rebuilt shortly afterwards, mostly of wood, as before. In a
Reformatio of 1320 the Government published a decree against the
excessive use of timber in construction. But the city was improving
in various ways. The streets were wider and more regular, and stone
steps were built on either side of the Stradone to make the higher
quarters more accessible. Elaborate rules were issued to ensure the
solidity of the roofs and chimneys, and by 1355 the town was paved
with brick.273 The steep streets on the seaward ridge and on the
eight slopes of Monte Sergio began to assume their present aspect,
although but few details of fourteenth-century domestic architecture
have remained. There are several houses in the Venetian Gothic
style, but these were built during the Hungarian occupation, the
artistic influence of Venice outlasting her political suzerainty.
Of the plastic arts we find as yet only slight beginnings, but we may
mention a few early paintings in the Dominican church. A large
crucifix in the Byzantine style, which hangs over the choir arch, was
vowed during the black death of 1348. In the sacristy there is a
polyptych in ten sections, with the Baptism of Christ in the centre of
the lower row, and St. Michael, St. Nicholas, St. Blaize, and St.
Stephen; the Virgin, with St. Peter, St. Dominic, St. Peter Martyr, and
St. Francis above. The work is very primitive; but if it be by a local
master, it is probably of a later date than the style suggests. The
robes are very rich and profusely gilt, but the effect is garish rather
than brilliant, although restoration may perhaps be responsible for
this. A Byzantine Madonna and Child in red is in the same church
between the nave and the transept.
In the city records there are occasional entries alluding to the
engagement of painters, and in 1344 a certain Magister Bernardus
was commissioned to paint the new hall of the communal palace,
which he was to decorate “pomis et stellis auratis.” No trace of this
work has survived.
An interesting piece of sculpture is the bas-relief of St. Blaize on a
wall near the Porta Ploce. The figure is seen in profile, and carries a
crozier with a Lamb in the crook. It is somewhat stiff and Oriental in
pose, but full of character. Curiously enough, it is the only really
good statue of the city’s patron saint at Ragusa. Other images may
be seen over the gates, on the fortifications, and on various
buildings, but they are all colourless and of very rough workmanship.
A plaque of marble, with figures in high relief, in the sacristy of the
Franciscan church, deserves notice. It is said to be thirteenth-
century work of the Isola di Mezzo.
During the next two hundred years architecture attains to its full
development, and at least one painter arises whose work is of
considerable value, while the goldsmith’s and silversmith’s art come
to occupy an important place.
CHAPTER VII

RAGUSA UNDER HUNGARIAN SUPREMACY—THE TURKISH INVASION, 1358-1420

B
Y the treaty of 1358 the whole eastern shore of the Adriatic as
far as Durazzo was ceded to Hungary, but as a matter of fact
that Power only extended its occupation as far as Ragusa. Not
having a strong fleet, King Louis feared that the more southern cities
would be difficult to hold, and he therefore never exercised his
treaty rights over them. Venice, having lost with Dalmatia her chief
naval base, turned her attention towards Albania and the adjoining
Slavonic countries. She had at one time occupied Durazzo (1205-
1208), and through her colonies in Dalmatia had come into contact
with the Albanians. Now that her influence in the former country was
destroyed, and that she had lost a large part of her mainland
possessions, the population devoted itself to “the bee-like task of
accumulating wealth and extending its commerce.”274 Relations
were once more established with Albania, trade with that country
was encouraged, and the foundations were laid for the revival of
Venetian influence in the Adriatic.275
The conditions of the Slavonic states behind Dalmatia were at this
time extremely disturbed. During the brilliant reign of Stephen
Dušan, the Servian people were at the height of their greatness and
power. Macedonia, Albania, and other parts of the Greek Empire,
and a part of Bosnia, as well as Servia proper, acknowledged the rule
of the Servian Tsar, and even Bulgaria paid him tribute. The great
position of Servia under this ruler is not usually appreciated by
historians of the Eastern Empire. Dušan, as Professor Bury
observes,276 was not only a great warrior, but a great legislator, and
drew up the Zakonik or code of laws, comparable with that of
Jaroslav for Russia. Had he lived a few years longer, and been able
to crush the turbulence of his feudal vassals and consolidate his
possessions, Kossovo might never have taken place, and the Balkans
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