Murach's C#
How to work with ADO.NET classes through code

This chapter shows you how to separate the database processing code from the user interface code by creating a separate database class to handle your application's database access. To do that, you must write code that creates and works with the data adapter, connection, and command objects. This chapter also shows you how to execute data commands without using a data adapter, how to process the results using a data reader instead of a dataset, and how to create and use transactions to insure data integrity when related tables are updated. With these skills, you'll be able to create database classes that provide the methods that do all the database processing for an application, which is the way it's commonly done in the real world.

Chapter 20 How to work with ADO.NET classes through code
How to work with connections and commands 610
How to create and work with connections 610
How to create and work with commands 612
How to use parameters in SQL statements 614
How to create and work with parameters 616
How to execute data commands 618
How to create and work with a data reader 618
How to execute queries that return a single value 620
How to execute action queries 620
How to work with untyped datasets and data adapters 622
How to create and work with untyped datasets 622
How to create and work with data adapters 624
A Product Maintenance application that uses data commands 626
The design of the Product Maintenance application 626
The code for the database classes 628
The code for the form class 634
How to use transactions 640
How to create and work with transactions 640
An Order Entry application that uses a transaction 642
The code for the OrderDB class 644




Murach's C#

Learn more about this book

Add this book to your cart



Our Ironclad Guarantee

First, try our books for 90 days. Then, if you aren't completely convinced that our books are the best ones you've ever used, you can return them for a full refund...no questions asked.