Create Connection String Using Data Directory

In this article I am going to explain about how to create connection string using data directory to SQL server express instance in .NET Framework.
  • 2770

Introduction

Here I am explaining how to create connection string by using the data directory to SQL server express instance in .NET Framework.

To create connection string by using the data directory SQL server express instance for SQL server we need to put filename which you want to attach, your database name, and set the state of Trusted connection yes.

Syntax

Server=.\SQLExpress;AttachDbFilename=|DataDirectory|urdbfile.mdf;Database=dbname;Trusted_Connection=Yes;

Further Readings

You may also want to read these related articles :

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.