The start directory vs AttachDbFilename in the ado.net connection string

When it comes to Ado.net connection strings, I used the Initial Catalog attributes in most of my projects.

But now most downloaded sample projects make extensive use of AttachDbFilename attributes in the connection string.

I know in both directions can connect to the database correctly. But I really would like to know that there are some differences.

Because now I still couldn’t decide which direction I really needed to follow when it comes to my MVC project, which really should include several requests at the same time.

Each offer will be truly appreciated.

+4
source share
1 answer

AttachDbFilename is when you work with SQL Express or SQL CE locally. It allows you to directly specify the name of the .MDB database file. It was used locally during development.

When you submit your application to production and an instance of SQL Server, you use the Initial Catalog to specify the name of the database. You are not worried about the => files that are processed by SQL Server.

+5
source

Source: https://habr.com/ru/post/1396994/


All Articles