I spent few days to create SQL Server Express database in App_data
folder.
It always creating database in default location.
I have following connection string in my web.config file. data file created in default location.
<connectionStrings>
<add name="PersonDBContext"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFileName=Customers.mdf;Integrated Security=True;User Instance=True;Persist Security Info=True;"
providerName="System.Data.SqlClient" />
</connectionStrings>
Is there a working sample code available for this?
-sr
Solution:
After posting this message I changed my connection like this:
<connectionStrings>
<add name="PersonDBContext"
connectionString="data source=.\SQLEXPRESS;Initial Catalog=CustomerInfoDB;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Customers.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
my data file creating in project app_data
folder.
Now my question is, I want to deploy this code in my production server, what is the best way to move this data file to prod server?
Do I need to install SQL Express on production server?
Thanks
-SR