Instant ebooks textbook Practical Database Programming with Visual Basic NET 1st Edition Ying Bai download all chapters
Instant ebooks textbook Practical Database Programming with Visual Basic NET 1st Edition Ying Bai download all chapters
https://ebookfinal.com/download/practical-database-programming-with-
visual-basic-net-2nd-edition-ying-bai/
https://ebookfinal.com/download/clearly-visual-basic-programming-with-
microsoft-visual-basic-2010-2nd-edition-diane-zak/
https://ebookfinal.com/download/essential-asp-net-with-examples-in-
visual-basic-net-1st-edition-fritz-onion/
https://ebookfinal.com/download/building-distributed-applications-
with-visual-basic-net-dan-fox/
Developing Web applications with Visual Basic NET and ASP
NET 1st Edition John Alexander
https://ebookfinal.com/download/developing-web-applications-with-
visual-basic-net-and-asp-net-1st-edition-john-alexander/
https://ebookfinal.com/download/microsoft-visual-basic-net-
programming-for-the-absolute-beginner-1st-edition-jonathan-s-harbour/
https://ebookfinal.com/download/mastering-visual-basic-net-1st-
edition-petroutsos/
https://ebookfinal.com/download/visual-basic-net-bible-1st-edition-
bill-evjen/
https://ebookfinal.com/download/visual-basic-and-visual-basic-net-for-
scientists-and-engineers-1st-edition-christopher-frenz-auth/
Practical Database Programming with Visual Basic NET
1st Edition Ying Bai Digital Instant Download
Author(s): Ying Bai
ISBN(s): 9780521885188, 0521885183
Edition: 1
File Details: PDF, 45.71 MB
Year: 2008
Language: english
This page intentionally left blank
Practical Database Programming with Visual Basic.NET
Ying Bai
Johnson C. Smith University
www.cambridge.org
Information on this title: www.cambridge.org/9780521885188
© Ying Bai 2009
1. Introduction 1
1.1 Outstanding Features of This Book 2
1.2 Whom This Book Is For 2
1.3 What This Book Covers 3
1.4 How This Book Is Organized and How to Use This Book 5
1.5 How to Use the Source Code and Sample Databases 6
1.6 Instructor and Customer Support 7
1.7 Homework Solutions 8
2. Introduction to Databases 10
2.1 What Are Databases and Database Programs? 11
2.1.1 File Processing System 11
2.1.2 Integrated Databases 12
2.2 Developing a Database 13
2.3 Sample Database 14
2.3.1 Relational Data Model 14
2.3.2 Entity-Relationship (ER) Model 17
2.4 Identifying Keys 18
2.4.1 Primary Key and Entity Integrity 18
2.4.2 Candidate Key 19
2.4.3 Foreign Keys and Referential Integrity 19
2.5 Define Relationships 19
2.5.1 Connectivity 19
2.6 ER Notation 23
2.7 Data Normalization 23
2.7.1 First Normal Form 24
2.7.2 Second Normal Form 24
2.7.3 Third Normal Form 25
vii
viii Contents
3. Introduction to ADO.NET 87
3.1 ADO and ADO.NET 87
3.2 Overview of ADO.NET 88
3.3 The Architecture of ADO.NET 89
3.4 The Components of ADO.NET 91
3.4.1 The Data Provider 91
3.4.1.1 The ODBC Data Provider 92
3.4.1.2 The OLE DB Data Provider 93
3.4.1.3 The SQL Server Data Provider 93
3.4.1.4 The Oracle Data Provider 93
3.4.2 The Connection Class 94
3.4.2.1 The Open() Method of the Connection Class 96
3.4.2.2 The Close() Method of the Connection Class 97
3.4.2.3 The Dispose() Method of the Connection
Class 97
3.4.3 The Command and Parameter Classes 98
3.4.3.1 The Properties of the Command Class 99
3.4.3.2 The Constructors and Properties of the
Parameter Class 99
3.4.3.3 Parameter Mapping 100
3.4.3.4 The Methods of the ParameterCollection
Class 102
3.4.3.5 The Constructor of the Command Class 104
3.4.3.6 The Methods of the Command Class 105
3.4.3.6.1 The ExecuteReader Method 105
3.4.3.6.2 The ExecuteScalar Method 106
3.4.3.6.3 The ExecuteNonQuery Method 106
3.4.4 The DataAdapter Class 107
3.4.4.1 The Constructor of the DataAdapter Class 108
3.4.4.2 The Properties of the DataAdapter Class 108
3.4.4.3 The Methods of the DataAdapter Class 108
3.4.4.4 The Events of the DataAdapter Class 109
3.4.5 The DataReader Class 110
x Contents
Index 781
Preface
xxvii
xxviii Preface
programming with Visual Basic 2005, along with authentic examples and detailed
explanations. More important, a new writing style implemented in this book, com-
bined with real examples, provides readers with a clear picture of how to handle
database programming issues in the Visual Basic.NET 2005 environment.
The outstanding features of this book include, but are not limited to, the follow-
ing:
1. A unique writing style is adopted to try to attract students’ or beginning pro-
grammers’ interest in learning and developing practical database programs,
and to avoid the headache caused by huge blocks of code, as is common in
traditional database programming books.
2. A real, completed sample database, CSE DEPT, with three versions
(Microsoft Access, SQL Server 2005, and Oracle Database 10g XE), is pro-
vided and used for the entire book. Step-by-step, detailed illustrations and
descriptions about how to design and build a practical relational database are
provided.
3. Both fundamental and advanced database programming techniques are cov-
ered for the convenience of both beginning students and experienced pro-
grammers.
4. Three types of popular databases are covered and discussed in detail with
practical sample examples: Microsoft Access, SQL Server 2005, and Oracle
Database 10g XE.
5. Various actual data providers are discussed and implemented in the sample
projects, such as the SQL Server and Oracle data providers. Instead of using
OLE DB to access the SQL Server or Oracle databases, real SQL Server
and Oracle data providers are utilized to connect to Visual Basic.NET 2005
directly to perform data operations.
6. It is a good textbook for college students and a good reference book for pro-
grammers, software engineers, and academic researchers.
I sincerely hope that this book will help readers or users develop and build pro-
fessional and practical database applications.
Acknowledgments
The first and most special thanks go to my wife, Yan Wang. I could not have finished
this book without her sincere encouragement and support.
I would also like to thank Dr. Satish Bhalla, who is the chapter contributor for
this book. He is a specialist in database programming and management, especially
in SQL Server, Oracle, and DB2. Dr. Bhalla spent a lot of time preparing materials
for Chapter 2, and he deserves thanks for this.
Many thanks to my editor, Heather Bergman, for helping to make this book a
reality. You would not have found this book in the market without her deep per-
spective and hard work. Thanks are also extended to the editing team of this book.
Without their contributions, it would have been impossible for this book to get pub-
lished.
Thanks should also be extended to the following book reviewers for their invalu-
able opinions on this book:
Dr. Jifeng Xu, Research Scientist, The Boeing Company
Dr. Xiaohong Yuan, Associate Professor, Department of Computer Science,
North Carolina A&T State University
Dr. Daoxi Xiu, Application Analyst Programmer, North Carolina Administra-
tive Office of the Courts
Dr. Dali Wang, Assistant Professor, Department of Physics and Computer Sci-
ence, Christopher Newport University
Last but not least, I thank all the people who supported me in finishing this book.
xxix
Practical Database Programming with Visual Basic.NET
1
Introduction
For years, during my teaching of database programming and Visual Basic.NET pro-
gramming at the college level, I found it so difficult to find a good textbook for
these topics that I had to combine a few different professional books together as
references to teach my course. Most of those books are specially designed for pro-
grammers or software engineers, cover a lot of programming strategies, and include
huge blocks of code, which cause terrible headaches for college students or begin-
ning programmers who are new to Visual Basic.NET and database programming. I
had to prepare my class presentations and figure out all the homework and exercises
for my students. I dreamed that one day I would find a good textbook that would be
suitable for college students or beginning programmers to help them learn and mas-
ter database programming with Visual Basic.NET easily and conveniently. Finally I
decided that I needed to do something about this dream myself after a long period
of waiting.
Another reason I had the idea for this book is the job market. As you know,
most industrial and commercial companies in the United States are database appli-
cation businesses, such as manufacturers, banks, hospitals, and retail stores. A
majority of them need professional people to develop and build database-related
applications, but not database management and design systems. To enable our stu-
dents to become good candidates for those companies, we need a book like this
one.
Unlike most of the database programming books in the current market, which
discuss and present database programming techniques with huge blocks of program-
ming code from the first page to the last page, this book uses a new writing style to
show readers, especially college students, how to develop professional and practi-
cal database programs in Visual Basic.NET by using Visual Basic.NET 2005 Design
Tools and Wizards related to ADO.NET 2.0 and how to apply code that is auto-
generated by using Wizards. With this new style, the headache caused by those huge
blocks of programming code is eliminated. Instead, a simple and easy way to create
database programs using the Design Tools can be developed to attract students’
1
2 Introduction
interest and enable students to build professional and practical databases in more
efficient and interesting ways.
There are so many different database programming books available in the mar-
ket, but one can rarely find a book like this one, which implements a new writing
style to hold students’ interest. To meet the needs of experienced or advanced stu-
dents and software engineers, the book contains two programming methods: the
fundamental database programming method using Visual Basic.NET 2005 Design
Tools and Wizards and the advanced database programming method using the
runtime object method. In the second method, all database-related objects are
created and applied while the project is running by utilizing a few blocks of
code.
This chapter is divided into two parts. Methods 1 and 2 are related to Visual
Basic.NET design tools and wizards and therefore are covered in Part I. The
third method is related to runtime objects and therefore is covered in Part II.
4 Introduction
Nine real projects are used to illustrate how to perform data insertion in three
different databases: Access, SQL Server 2005, and Oracle Database 10g XE.
Some professional and practical data validation methods are also discussed in
this chapter to confirm the data insertion.
Chapter 6 provides discussions and analyses of three popular data updating and
deleting methods:
This chapter is also divided into two parts. Methods 1 and 2 are related to Visual
Basic.NET design tools and wizards and therefore are covered in Part I. The
third method is related to runtime objects and is covered in Part II. Seven real
projects are used to illustrate how to perform data updating and deleting in three
different databases: Access, SQL Server 2005, and Oracle Database 10g XE.
Some professional and practical data validation methods are also discussed in
this chapter to confirm the data updating and deleting actions. The key points to
remember when updating and deleting data in a relational database, such as the
order in which to execute data updating and deleting in parent and child tables,
are also discussed and analyzed.
Chapter 7 provides introductions to and discussions about the development and
implementation of ASP.NET Web applications in the Visual Basic.NET 2005
environment. At the beginning of Chapter 7, detailed and complete descrip-
tions ASP.NET and Microsoft .NET Framework are provided. This part is
especially useful and important to students or programmers who do not have
any knowledge of or background in Web application development and imple-
mentation. Following the introduction section, a detailed discussion of how
to install and configure the environment to develop ASP.NET Web appli-
cations is provided. Some essential tools, such as the Web server, Internet
Information Services (IISs), and FrontPage Server Extension 2000 or 2002,
and the installation process for these tools are introduced and discussed in
detail. Starting with Section 7.3, the detailed development and building pro-
cesses of ASP.NET Web applications to access databases are discussed with six
real Web application projects. Two popular databases, SQL Server and Ora-
cle, are utilized as the target databases for these development and building
processes.
Chapter 8 provides introductions to and discussions about the development
and implementation of ASP.NET Web services in the Visual Basic.NET
2005 environment. A detailed discussion and analysis of the structure and
1.4 How This Book Is Organized and How to Use This Book 5
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. In all, eighteen projects, including the
Web service projects and the associated Web service client projects, are devel-
oped in this chapter. All projects have been debugged and tested and can be run
in Windows-compatible operating systems such as Windows 95, 98, 2000, XP,
and Vista.
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 program-
ming with Visual Basic.NET and professional database programmers who have
experience with this topic.
Chapters 2 and 3 provide the fundamentals of database structures and compo-
nents of ADO.NET. Chapters 4, 5, and 6 are each divided into two parts, a fun-
damental part and an advanced part. The data-driven applications developed with
design tools and wizards provided by Visual Basic.NET in the fundamental part
have less coding, and therefore are more suitable for students or programmers who
are new to database programming with Visual Basic.NET. Part II contains the run-
time object method and covers the development of code to perform different data
actions on the database. This method is more flexible and convenient for experi-
enced programmers because a lot of coding is required.
Chapters 7 and 8 give a full discussion and analysis the development and
implementation of ASP.NET Web applications and Web services. These technolo-
gies are necessary for students and programmers who want to develop and build
Web applications and Web services to access and manipulate data through the
Internet.
This book is organized so that it can be used at two levels, which are shown in
Figure 1.1.
It is highly recommended that undergraduate college students and beginning
programmers learn and understand the contents of Chapters 2 and 3 and Part I of
Chapters 4, 5, and 6 since those provide fundamental knowledge and techniques of
database programming with Visual Basic.NET 2005. Chapters 7 and 8 are optional
for instructors and depend on the time and schedule.
Step by step, a detailed description is given to illustrate how to design and set
up relationships between parent and child tables using the primary key and foreign
6 Introduction
keys for Access, SQL Server 2005, and Oracle Database 10g XE databases. In Part
I of Chapters 4–6, Visual Basic.NET design tools and wizards are discussed and
analyzed in detail to show readers how to use them to easily and conveniently design
and build professional database programs with Visual Basic.NET.
For experienced college students or software programmers who already have
some knowledge of database programming, it is recommended to learn and under-
stand the contents of Part II of Chapters 4–6 as well as Chapters 7 and 8 since
the runtime data object method and some sophisticated database programming
techniques, such as joined-table query, nested stored procedures, and Oracle
Package, are discussed and illustrated with real examples. Also, ASP.NET Web
applications and ASP.NET Web services are discussed and analyzed with twenty-
four real database program examples for SQL Server 2005 and Oracle Database
10g XE.
Only three species are known; one, P. sebæ, from the west coast
of Africa, the two others from the Indo-Pacific. P. argenteus is a very
common fish, attaining to a length of about 10 inches.
Fig. 199.—Psettus argenteus.
Platax.—Body much compressed and elevated; snout very short.
One dorsal, with the spinous portion nearly entirely hidden, and
formed by from three to seven spines; anal with three. Ventrals well
developed, with one spine and five rays. Teeth setiform, with an outer
series of rather larger teeth, notched at the top; palate toothless.
Scales of moderate size or rather small.
Third Family—Cyttidæ.
Body elevated, compressed, covered with small scales, or with
bucklers, or naked; eye lateral. Teeth conical, small. No bony stay for
the præoperculum. Dorsal fin composed of two distinct portions.
Ventrals thoracic. No prominent papilla near the vent. Gill-opening
wide. More than ten abdominal and more than fourteen caudal
vertebræ.
The fishes of the “Dory” family are truly marine, and inhabit the
temperate zone of the Northern and Southern Hemispheres. Some
fossils from tertiary formations (one from Licata) belong to the genus
Zeus.
Zeus.—A series of bony plates runs along the base of the dorsal
and anal fins; another series on the abdomen. Three or four anal
spines.
Fourth Family—Stromateidæ.
Body more or less oblong and compressed, covered with very
small scales; eye lateral. Dentition very feeble; œsophagus armed
with numerous horny, barbed processes. No bony stay for the
præoperculum. Dorsal fin single, long, without distinct spinous
division. More than ten abdominal and more than fourteen caudal
vertebræ.
This small family consists of strictly marine and partly pelagic
species referred to two genera, Stromateus and Centrolophus. The
former lacks ventral fins, at least in the adult stage, and is
represented by about ten species in almost all the tropical and
warmer seas. Centrolophus, hitherto known from two or three
European species only (of which one occasionally reaches the south
coast of England, where it is named “Black-fish”), has recently been
discovered on the coast of Peru, and has probably a much wider
range.
Fifth Family—Coryphænidæ.
Body compressed; eye lateral. Teeth small, conical, if present;
œsophagus smooth. No bony stay for the præoperculum. Dorsal fin
single, long, without distinct spinous division. More than ten
abdominal and more than fourteen caudal vertebræ.
All the members of this family have pelagic habits.
Representatives of it have been recognized in some fossil remains:
thus Goniognathus from the Isle of Sheppey, and the living genus
Mene (Gastrocnemus) at Monte Bolca.
Coryphæna.—Body compressed, rather elongate; adult
specimens with a high crest on the top of the head; cleft of the mouth
wide. A single dorsal extending from the occiput almost to the caudal,
which is deeply forked; no distinct dorsal and anal spines. The
ventrals are well developed, and can be received in a groove on the
abdomen. Scales very small. Rasp-like teeth in the jaws, on the vomer
and the palatine bones. Air-bladder absent.
Sixth Family—Nomeidæ.
Body oblong, more or less compressed, covered with cycloid
scales of moderate size; eye lateral. No bony stay for the
præoperculum. Dorsal fin with a distinct spinous portion separated
from the soft; sometimes finlets; caudal forked. More than ten
abdominal, and more than fourteen caudal vertebræ.
Marine fishes; pelagic, at least when young.
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.
ebookfinal.com