
Professional Visual Studio 2005 (2006) [eng]
.pdf

Connection Strings
A large proportion of applications need to persist data, and the obvious candidate for enterprise software is a relational database. The .NET Framework provides support for working with SQL Server, Oracle, ODBC, and OLE DB databases. To connect to any of these databases you need to specify a connection string that determines the location, the database, authentication information, and other connection parameters. This chapter explains how to create and store connection strings. In addition, you’ll learn about encrypting and working with connection strings in code.
Data Source Configuration Wizard
Connection strings are similar to XML in that although they can be read, it is neither an enjoyable experience nor recommended to work with them directly. Because connection strings are strings, it is easy to introduce errors, misspell words, or even omit a parameter. Unlike XML, which can easily be validated against a schema, connection strings are harder to validate. The Data Source Configuration Wizard built into Visual Studio 2005 enables you to specify database connections without having to manually edit the connection string itself.
You can invoke the Data Source Configuration Wizard in a number of ways, as you will experience when you start working with any of the data controls in either the Windows form or web form designers. For the purposes of illustrating the wizard, follow these steps to add a new data source to an existing Windows Forms application. You’ll connect to the sample AdventureWorks database, which you will need to download from the Microsoft web site (www.microsoft.com).







