MS SQL


How to fix: Failed to generate a user instance of SQL Server ?
If you are receiving the following error:
System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

It means you are either trying to connect an mdf file to the SQL server or are in another way trying to create your own instance of SQL server. In a shared environment, it is not possible to do this. To use that database file, you will need to make a backup of it in a .bak format. Then, from your control panel:
  1. Make a database
  2. Restore the .bak file into the database
  3. Change your connection string to appropriately use the SQL server instance on your server