Connection String To Connect To .MDF


Answer :

If you're using the *.mdf file in the App_Data folder of an ASP.NET app you can use this.




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




If it's not an ASP.NET application don't use the DataDirectory syntax and just use the full c:\... path.



Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable