What to do with error “You don’t have permission to open this file”. VB.Net express edition

If you are using Visual Basic 2010 Express, you may see the error message above when you try to connect to a database. An easy way to fix this problem (but not the only way) is to use the Browse button in the Add Connection dialog box shown below, navigate to the DATA directory for SQL Server on your hard drive (see the location near the bottom of page 2 of this document), and select the particular database.mdf file.

Then, when you see the message that’s shown below, click Yes to add the database file to your project as a local file: