Home > Store

Database Access with Visual Basic .NET, 3rd Edition

Register your product to gain access to bonus material or receive a coupon.

Database Access with Visual Basic .NET, 3rd Edition


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2003
  • Dimensions: 7-3/8" x 9-1/4"
  • Pages: 464
  • Edition: 3rd
  • Book
  • ISBN-10: 0-672-32343-5
  • ISBN-13: 978-0-672-32343-0

Whether you are using WinForms, WebForms, or Web Services, Database Access with Visual Basic® .NET, Third Edition, is your practical guide to developing database applications with Visual Basic .NET and ADO.NET. The authors provide real-world solutions to the data-access issues Visual Basic .NET developers face every day and share their secrets for becoming a more effective database programmer using .NET technologies.

The book begins by reviewing the fundamentals of database development, Structured Query Language (SQL), and Microsoft SQL Server™ 2000. It then examines how to use the major ADO.NET objects to access data stored in relational databases. Through detailed examples, readers learn how to use properties and methods, as well as more advanced features and techniques. Extensive code listings in Visual Basic .NET illustrate each concept, while business cases apply concepts to real-world applications. The final chapters provide a solid examination of how XML and ASP.NET integrate with ADO.NET to create various types of database applications. A companion Web site provides the code used in the book's myriad examples, all of which is compatible with Visual Basic .NET 2003.

Key topic coverage includes:

  • SQL queries and commands
  • Using SQL Server 2000
  • ADO.NET objects
  • Advanced ADO.NET features and techniques
  • SQL Server and OLEDB, as well as ODBC .NET Data Providers
  • Using Visual Studio .NET Data Projects for managing SQL Scripts
  • Integrating XML with ADO.NET
  • Developing Web-based database applications with ASP.NET
  • Web services and middle-tier objects
  • Database Access with Visual Basic® .NET, Third Edition, equips VB developers with the knowledge and skills needed to build a powerful new generation of database applications in less time using .NET technologies.



    Source Code

    Download the Source Code related to this title.


    Author's Site

    Untitled Document

    Click below for Web Resources related to this title:
    Author Web Site

    Sample Content

    Online Sample Chapter

    Visual Studio.NET Database Projects

    Downloadable Sample Chapter

    Click below for Sample Chapter(s) related to this title:
    Sample Chapter 8

    Table of Contents


    1. Database Basics.

    What Is a Database?

    What Is a Database Platform?

    Business Cases.

    Business Case 1.1: Introducing Jones Novelties, Incorporated.

    Tables and Fields.

    Designing Your Database.

    Business Case 1.2: Designing Tables and Relationships.

    Manipulating Data with Objects.

    Data Types.

    Creating a Database Schema.

    Using Visual Studio to Create a Database.

    Designating Indexes and the Primary Key.

    Creating Database Diagrams.

    Using Microsoft Visio to View and Alter a Database Schema.


    Using Referential Integrity to Maintain Consistency.

    Testing Referential Integrity Constraints, Using Server Explorer.

    Cascading Updates and Cascading Deletes.


    One-to-One Relationships.

    One-to-Many Relationships.

    Many-to-Many Relationships.

    Creating a User Interface in a Windows Forms Application.

    Connecting to a Database and Working with Records.

    Creating a Data Browser Application.

    Performing Binding Programmatically.

    About Data-Aware Controls in .NET.

    Updating Records in the Data Browser Application.

    Creating New Records in a Data-Bound Form.

    Deleting Records from a Data-Bound Form.

    Validating Data Entry in a Data-Bound Form.

    Validation at the Database Engine Level.


    Questions and Answers.

    2. Structured Query Language Queries and Commands.

    What is a Query?

    Testing Queries with the Server Explorer.

    Retrieving Records with the SELECT Clause.

    Designating a Record Source with the FROM Clause.

    Specifying Criteria with the WHERE Clause.

    Operators in WHERE Clauses.

    Sorting Results with ORDER BY.

    Sorting in Descending Order.

    Sorting on Multiple Fields.

    Displaying the Top or Bottom of a Range with TOP.

    Creating Top Percentage Queries.

    Joining Related Tables in a Query.

    Expressing a Join in SQL.

    Using Outer Joins to Return Additional Data.

    Performing Calculations in Queries.

    Aliasing Field Names with AS.

    Queries That Group and Summarize Data.

    Using HAVING to Provide Criteria for Grouped Queries.

    The SUM Function.

    Other SQL Aggregate Functions.

    Union Queries.


    Manipulating Data with SQL.

    Update Commands.

    Delete Commands.

    Insert Commands.

    Creating Tables with SELECT INTO.

    Using Data Definition Language.

    Creating Database Elements with CREATE.

    Adding Constraints to Tables.

    Creating Indexes with CREATE INDEX.

    Deleting Tables and Indexes with DROP.

    Modifying a Tables Definition with ALTER.


    Questions and Answers.

    3. Getting Started with SQL Server 2000.

    Setting Up and Running Microsoft SQL Server 2000.

    Determining Installation Requirements for SQL Server 2000.

    Installing SQL Server 2000.

    Starting and Stopping SQL Server with SQL Service Manager.

    Controlling the Way SQL Server Starts Up.

    Getting Started with SQL Server 2000: The Basics.

    Running SQL Server Enterprise Manager.

    Creating a Database with SQL Enterprise Manager.

    Creating Tables in a SQL Server Database.

    Using SQL Query Analyzer to Access a Database.

    Using Database Views to Control Access to Data.

    Creating and Running Stored Procedures.

    Displaying the Text of an Existing View or Stored Procedure.

    Creating Triggers.

    Business Case 3.1: Creating a Trigger That Enables Soundalike Searches.

    Managing Users and Security in SQL Server Enterprise Manager.

    Applying Security Attributes in SQL Query Analyzer.

    Removing Objects from the Database

    Business Case 3.2: Generating an SQL Script That Creates a Database.


    Questions and Answers.

    4. ADO.NETData Providers.

    Overview of ADO.NET.

    Motivation and Philosophy.

    ADO.NET Versus Classic ADO (2.x).

    ADO.NET Objects Within the .NET Framework.

    Application Interfaces.

    Overview of .NET Data Provider Objects.




    Core Objects.

    The Connection Object.

    The Command Object.

    Using the Command Object with Parameters and Stored Procedures.

    Executing the Commands.

    The DataReader Object.

    Using the Connection and Command Design-Time Components.

    Other Data Provider Objects.

    Business Case 4.1: Writing a Routine to Archive Old Orders by Year.


    Questions and Answers.

    5. ADO.NETThe DataSet.

    Applications and Components of the DataSet.

    Populating and Manipulating the DataSet.

    Defining DataTable Schemas.

    Adding Data to a DataTable.

    Updating the DataSet.

    Accessing Data from a DataTable.

    Table Relations.

    Table Constraints.

    Using the DataSet Component.


    Questions and Answers.

    6. ADO.NETThe DataAdapter.

    Populating a DataSet from a Data Source.

    Updating the Data Source.

    Setting the Update Commands.

    Business Case 6.1 Combining Multiple Related Tables.


    Questions and Answers.

    7. ADO.NETAdditional Features and Techniques.

    Detecting Concurrency Conflicts.

    Table and Column Mappings.


    Business Case 7.1: Viewing Data Combined from Different Sources.

    Strongly Typed DataSets.


    Questions and Answers.

    8. Visual Studio.NET Database Projects.

    Creating a Database Project.

    Database References.


    Create Scripts.

    Change Scripts.

    Running the Scripts.

    Command Files.



    Questions and Answers.

    9. XML and .NET.

    An Overview of XML.

    The XML Family of Technologies.

    XML and Data Access.

    XML Classes in .NET.

    Working with the Document Object Model.

    Working with XPATH.

    Extending SQL Server with SQLXML 3.0 and IIS.

    Installing and Configuring SQLXML 3.0.

    Configuration Results.

    Using XML, XSLT, and SQLXML to Create a Report.


    Questions and Answers.

    10. ADO.NET and XML.

    Basic Reading and Writing of XML.

    Reading XML.

    Writing XML.


    Business Case 10.1: Preparing XML Files for Business Partners.

    Creating an XmlReader from a Command Object.

    The XmlDataDocument Object.


    Questions and Answers.

    11. WebForms: Database Applications with ASP.NET.

    An Overview of ASP.NET.

    HTML Controls Versus Server Controls.

    Additional Highlights of ASP.NET.

    Accessing a Database Through ASP.NET.

    Adding the ASPNET User to the SQL Server Logins.


    Working with the DataGrid.

    Improving the Performance of ASP.NET Database Applications Through Stored Procedures.


    Questions and Answers.

    12. Web Services and Middle-Tier Technologies.

    Using the Middle Tier to Provide Presentation Logic.

    Using Data in the Middle Tier.

    Creating Reusable Middle-Tier Components.

    Using the Component from Another Application.

    Exposing Objects Through Web Services.

    Exposing an Existing Object Through a Web Service.

    Accessing Web Services Programmatically.

    Putting It All Together.


    Questions and Answers.

    Index. 0672323435T01242003


    The purpose of this book is to show you how to development database applications using Visual Basic .NET and ADO.NET.

    Although both the OLEDB and the ODBC Data Providers for .NET are discussed (Chapter 4), almost all of the examples in this book will be for Microsoft SQL Server 2000. This is because it is readily available and used by most of our readers. Moreover, applying the concepts and making the required code modifications for other data sources is normally very straightforward. We tried to point out where there are significant differences.

    Even though we expect that most readers will be working with SQL Server, we do not assume that they are experienced with it. This may be because they are new to database applications, or because they only have experience with other databases such as Microsoft Access or Oracle. We have therefore included a hefty overview of Microsoft SQL Server. If you are experienced with SQL Server, you may want to skip this chapter, although since it covers a wide variety of topics, you may still find a "nugget" or two that makes it worthwhile for you to read the chapter.

    Along with the coverage of database access using SQL Server, we have included coverage of XML and XML integration with ADO.NET. This is a crucial aspect of developing database applications with VB .NET that is often overlooked or short-changed. However since XML is so important to developing modern data-driven applications, we have provided rather extensive coverage of this topic.

    You will notice that this book contains a lot of code and examples. We believe that this is the best way to understand the concepts that are presented. We normally provide relatively simple examples to demonstrate the concepts, and then present Business Cases to put the concepts into a "real-world" context.

    Who This Book Is For

    We assume that the reader of this book is already familiar with Visual Basic .NET. Although the code examples code step-by-step instructions, this book does not teach VB .NET syntax. We assume that you are comfortable enough with VB .NET and Visual Studio .NET, and do not waste your time reviewing these concepts once again. For example, we will not normally step through basic tasks, such as opening and savings project files, except maybe the first time we encounter them. We will, however, often show how to do the same thing in several different ways—we hope that this will extend your knowledge of VB .NET, without rehashing the basics. To the same end, you may also notice variant coding styles, and even screen shots on different versions of Windows—all illustrating the flexibility of VB .NET.

    Most of the examples in this book are shown using Windows Application (Windows Forms) as the project type. This is because nearly all VB programmers are most familiar and comfortable with this type of application. This allows us to focus on database access, rather than the technologies involved in the different types of .NET projects. Still, in later chapters, we do discuss and show ASP.NET web applications and web services, so that you see database access examples using these technologies and project types.

    How This Book Is Organized

    This book can be though of as containing three parts. The first part, consisting of Chapters 1-3, are the "preliminaries". The coverage of database basics, SQL, and SQL Server are meant to provide the fundamentals required to proceed comfortably throughout the rest of the book. At the same time, these chapters provide a good review of these topics even for someone who is experienced is these areas.

    The second part could be thought of as the core of the book. Chapters 4-7 provide in-depth explanations and numerous examples of the major ADO.NET objects and the use of their properties and methods. Chapter 7 goes beyond the basics to explore advanced features and techniques of the ADO.NET objects.

    The third part of the book goes beyond the fundamental use of ADO.NET and shows how the technologies and techniques previously presented should be used to build real applications. This part includes the use of Visual Studio Data Projects for managing SQL scripts (Chapter 8), as well as a discussion of XML (Chapter 9) and the integration of XML and ADO.NET in Chapter 10. Finally, shown are additional types of projects that utilize ADO.NET—Chapter 11 covers ASP.NET Web Applications and Chapter 12 covers Web Services and middle-tier objects.

    The Software Environment

    We are assuming that the reader has already installed, or is capable of installing, Visual Studio .NET. The only thing to note regarding this is that there are significant differences between available capabilities and behaviors of the visual database tools, depending on the edition of Visual Studio and the type of database that you use.

    Parts of Chapters 1, 2 and 8 use features found only in the Enterprise Developer or Enterprise Architect versions of Visual Studio.

    Regarding the installation of SQL Server, Chapter 3 provides step-by-step instructions for installing SQL Server 2000, for those not familiar with the process. It is recommended that you make a copy or backup of the pubs sample database that is installed with SQL Server, since many of the code examples use this database and some of them modify the data that it contains.

    All of the Business Cases and many of the other code examples use the Novelty database, designed for this book. Both Chapters 3 and 8 show the development of SQL scripts to create this database. The following are the steps required to create the Novelty database on your SQL Server:

    In order to use many of the code samples in the book, you must first create and populate the "Novelty" database on a SQL Server 2000 machine. The steps provided here assume that the user you are logging in as has the rights necessary to create a database on the server. Keep in mind that some people may refer to a database and actually mean the application that handles the data—that is not the case on any page of this book. When the word database is used here, it explicitly means the container of organized, relational data kept in SQL Server 2000.



    Click below to download the Index file related to this title:


    Submit Errata

    More Information

    Unlimited one-month access with your purchase
    Free Safari Membership