Cannot attach the AdventureWorks database
SQL Server service account don't have permission in the drive you are using to create database.Don't put you database in the root of drive. It would be problematic if you have UAC enabled, Create a folder in drive. Like D:\Data

Check this http://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx


ERROR_ACCESS_DENIED
5 (0x5)
Access is denied.


Make sure that the SQL Server Service Account has read/Write permission to the folder where database file is kept or use the instance default folder of Data/Log where it will already have such permissions.