Nearly every recipe in this book contains a code sample. The sample is not just a fragment, but rather a complete solution that takes the form of either a Windows Forms or a Web Forms application.
In many cases, the solution code contains additional code that lets you explore alternatives, test performance, and see information that will help you understand key concepts. Multiple solutions are sometimes presented. Where appropriate, one alternative will be recommended; in other cases, alternatives are equivalent and selection should be based on your specific application requirements.
Complete error handling is not included for each solution. Omitting error handling makes the solution easier to understand by focusing on the key concepts. Error handling that is a key part of the solution is included and explained thoroughly. These principles can also be applied to other solutions in this book.
All of the code examples in the book use C# as a programming language. Listing VB.NET solutions would have made the book less readable, added hundreds of pages to its length, and increased both cover price and weight. VB.NET code for all solutions in addition to C# code is available on the book’s web site, http://www.oreilly.com/catalog/adonetckbk. There are also release notes explaining installation and configuration.
.NET introduced the C# programming language as well as VB.NET. Both languages compile to the same intermediate language (IL) used by .NET and are more similar than different; differences are mainly syntactic. They can also be mixed within the same solution. Most VB.NET programmers have little trouble converting C# samples. The book C# and VB.NET Conversion Pocket Reference by Jose Mojica (O’Reilly) provides a concise (139-page) reference with all the details about converting between C# and VB.NET. The Appendix A covers this as well.
The solutions using SQL Server use the Northwind sample database. Some solutions require additional tables and stored procedures; these can be installed using the installation script from the example code from the web site. The Oracle solutions use either the SCOTT sample database installed with Oracle, or, in some cases where SCOTT is inadequate, a version of Northwind that has been ported to Oracle. Instructions for creating this database are also available in the example code.
Some solutions require stored procedures. Most are written for Microsoft SQL Server; however, in some cases Oracle is used because the recipe solves a problem specific to Oracle—identity columns in SQL Server versus sequences in Oracle, for example. SQL Server’s T-SQL is somewhat similar to Oracle’s PL/SQL; Oracle users, or users familiar with other procedural extensions to SQL, should have little difficulty understanding or adapting these stored procedures. The disconnected parts of the ADO.NET are database independent and are, for the most part, portable without modification regardless of the underlying data source.