O'Reilly logo

Professional Visual Studio 2012 by Bruce Johnson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 38

Connection Strings

WHAT’S IN THIS CHAPTER?

  • 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 2012 enables you to specify database connections without manually editing the connection ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required