Context
I'm working on a desktop app which must be able to run in case of connection loss with the distant sql server : a SQL Server Express (I know...) 2012. I'm working on Visual Studio Express 2013. So I figured out that my best option is to use SQLLocalDB as my client local DB as I just have to import my data-free mdf file and handle the data synch (which represent a quite simple enough ruleset) by myself. To attach the mdf file to SQLLocalDB, I have two options but I do not understand clearly the consequences of each one.
Solution 1 - Transact SQL
Solution 2 - Connexion string
"Server=(localdb)\\v11.0;Integrated Security=true;AttachDbFileName= myDbFile.mdf;"
What is the best way to go knowing that I use Entity Framework to access the data in code ?
My opinion is solution #2 is better because it's based on connection string to databse.
In SQL Express you can specify a db name in T-SQL too (USE DB_NAME
). But people usually specify db in a connection string rather than T-SQL
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With