Throughout this book, you'll see many example programs that
LISTING 1.1 : FIRSTEXAMPLE.CS
The filenames will
When you unzip this file, one directory for each chapter will be created. Each directory will contain the following sub-directories as required:
programs Contains the C# programs.
sql Contains SQL scripts.
VS. NET projects Contains the Visual Studio .NET projects.
xml Contains the XML files.
Not all chapters reference programs, sql scripts, etc., and therefore may not contain all the previous sub-directories.
is an organized collection of information that is divided into
. Each table is further divided into
In this chapter, you'll see a C# program that connects to a SQL Server database, retrieves and displays the contents stored in the columns of a row from a table, and then disconnects from the database. You'll also see programs that connect to Access and Oracle databases.
You'll also learn about Microsoft's rapid application development (RAD) tool, Visual Studio .NET (VS .NET). VS .NET enables you to develop, run, and debug programs in an integrated development environment. This environment uses all the great features of Windows, such as the mouse and intuitive
In the final sections of this chapter, you'll see how to use the
Featured in this chapter:
Obtaining the required software
Developing your first ADO.NET program
Connecting to Access and Oracle databases
Introducing Visual Studio .NET
Using the .NET documentation
Using the SQL Server documentation
Before you can develop C# programs, you'll need to install either the .NET Software Development Kit (SDK) or VS .NET. You can download the .NET SDK at http://msdn.microsoft.com/downloads (search for the Microsoft .NET Framework Software Development Kit). You can purchase a trial or full copy of VS .NET from Microsoft at http://msdn.microsoft.com/vstudio .
To install the .NET SDK, run the executable file you downloaded and follow the instructions on the screen to install it on your computer. To install VS .NET, run the setup.exe file on the disk and follow the instructions on the screen.
You'll also need a copy of the SQL Server database software. At time of writing, you can download a trial version of SQL Server from Microsoft at http://www.microsoft.com/sql . You can also purchase a trial or full copy of SQL Server from Microsoft's Web site.
This book uses the Developer Edition of the SQL Server 2000 software and uses a database named Northwind. This database contains the information for the fictitious Northwind Company, which sells food products to customers. Northwind is one of the example databases that you can install with SQL Server. Customer information in the Northwind database is stored in a table named Customers ; you'll see the use of this table in the example program later in this chapter.
If you don't want to download or purchase a trial version of SQL Server, the .NET SDK (and VS .NET) comes with a stand-alone desktop database server known as the Microsoft SQL Server 2000 Desktop Engine (MSDE 2000). MSDE 2000 has a version of the Northwind database that you can use instead of the SQL Server Northwind database-although you won't get all of the graphical administration tools that come with SQL Server. If you're using the .NET SDK and want to install MSDE 2000, select Start ➣ Microsoft .NET Framework SDK ➣ Samples and QuickStart Tutorials. If you're using VS .NET and want to install MSDE 2000, run the setup.exe program that you use to install VS .NET and select MSDE 2000 as a new feature to install.
You can learn more about MSDE 2000 at http://www.microsoft.com/sql/techinfo/development/2000/msde2000.asp .