Error: Failed to generate a user instance of SQL Server

ok, it works now! guess it was a compound problem … the steps I took to resolve it are as such:

  1. Changed the following property in the connection string (note the subtle difference): AttachDbFilename=|DataDirectory|CustomerDb.mdf;
  2. Deleted the contents of the following directory: c:\Users\<user name>\AppData\Local\Microsoft\Microsoft SQL Server Data\SQLEXPRESS. I thought I had looked for this before, but I had actually looked in the Microsoft Sql Server folder. Again, a subtle difference.

Once I did these two things, the connection started working 😀

Leave a Comment