

The following example is for a SQL Server Express database in an. The example assumes that the SQL Server Express instance is named SQLEXPRESS, which is the default. The following example is for a SQL Server Express database that is defined in the local SQL Server Express instance. SQL Server Express Connection String Examples įor more information about connection string settings, see Data Source, AttachDbFileName, Initial Catalog, Integrated Security, and MultipleActiveResultSets later in this topic. The following example specifies the default automatic instance name for LocalDB.

There is no corresponding API for SQL Server Compact. You can also construct connection strings in code by using the SqlConnectionStringBuilder API for SQL Server Express, LocalDB, SQL Server, or SQL Database. For more information about Entity Framework connection strings, see Entity Framework Connections and Models. In all of the examples, if you are using Entity Framework Code First, ConnectionStringName is typically the name of the context class. The examples show the connection strings as they appear in the ConnectionStrings element of the Web.config file, where the connectionString attribute must be accompanied by a providerName attribute. Integrated Security (synonym: Trusted_Connection) How to Convert a LocalDB Connection String to SQL Server Expressĭata Source (synonyms: Server, Addr, Address, Network Address)ĪttachDbFileName (synonyms: Initial File Name, Extended Properties) How to Convert a SQL Server Express Connection String to LocalDB SQL Server Compact Connection String ExampleĬonverting Connection Strings between LocalDB and SQL Server Express


Windows Azure SQL Database (formerly SQL Azure) Connection String ExampleĮntity Framework Database First or Model First Connection String Example SQL Server (Full Editions) Connection String Examples The topic contains the following sections: It also includes instructions for converting connection strings between SQL Server Express and LocalDB, and explanations of some common connection string settings. This topic provides examples of SQL Server connection strings for typical ASP.NET web application scenarios.
