Chapter 38Connection Strings

  • Creating connection strings for use in your application
  • Working with the Visual Studio 2012 Connection dialogs to specify how to connect to a data source
  • Accessing connection strings from within code

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, SQL Server Compact Edition, Oracle, ODBC, and OLE DB databases. Many other databases are also supported through third-party providers. To connect to any of these databases, you need to specify a connection string that determines the location of the server or database engine, the name of 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.

CONNECTION STRING 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 Connection String Wizard built into Visual Studio 2013 enables you to specify database connections without manually editing the ...

Get Professional Visual Studio 2013 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.