Reputation: 4474
When it comes to Ado.net connection strings, I have used Initial Catalog
attributes at most of my projects.
But now most of the downloaded sample projects widely use AttachDbFilename
attributes at connection string.
I know both ways can connect to database correctly. But what I really would like to know is that is there any differences.
Because now I still could not decide which way I really need to follow when it comes to my MVC project which is really need to provide for multiple requests at the same time.
Upvotes: 6
Views: 2764
Reputation: 1038990
AttachDbFilename
is when you are working with SQL Express or SQL CE locally. It allows you to specify directly the name of the .MDB database file. It's used locally during development.
When you ship your application into production and a SQL Server instance you use Initial Catalog
to specify the database name. You don't bother with filenames => that's handled by SQL Server.
Upvotes: 8