C
C#4w ago
Cheems🤡

Facing Operating System error 3 while adding .mdf file in App_Data

Here's the dailog box error I'm getting while adding a .mdf file in App_Data of my dotnet mvc solution. The .mdf file is added, but the.ldf file is not.
Create file encountered operating system 3 (The system cannot find the path specified). while attempting to open or create the physical file 'C:\Users\User_Name\Desktop\L.NETMVC\12 Remember Me Functionality\App_data\LoginDB.ldf'.

CREATE DATABASE failed. Some files names listed could not be created. Check related errors. User does not have permission to alter database 'database_no', the database does not exist, or the database is not in a state that allows access checks.

ALTER DATABASE statement failed.

The Database 'database_no" does not exist. Supply a valid database name. To see available databases, use sys.databases.
Create file encountered operating system 3 (The system cannot find the path specified). while attempting to open or create the physical file 'C:\Users\User_Name\Desktop\L.NETMVC\12 Remember Me Functionality\App_data\LoginDB.ldf'.

CREATE DATABASE failed. Some files names listed could not be created. Check related errors. User does not have permission to alter database 'database_no', the database does not exist, or the database is not in a state that allows access checks.

ALTER DATABASE statement failed.

The Database 'database_no" does not exist. Supply a valid database name. To see available databases, use sys.databases.
I tried restarting VS as an administrator but am still facing the issue.
No description
2 Replies
mtreit
mtreit4w ago
I guess this was asked quite some time ago, but error code 3 generally means one of the folders in the path was not found. Are you positive this path exists? What happens if you do this in PowerShell:
dir "C:\Users\User_Name\Desktop\L.NETMVC\12 Remember Me Functionality\App_data\LoginDB.ldf"
dir "C:\Users\User_Name\Desktop\L.NETMVC\12 Remember Me Functionality\App_data\LoginDB.ldf"
Cheems🤡
Cheems🤡OP4w ago
Thanks for responding. Yeah, I did check it. I tried doing the same in another location, and there were no issues, so I completed the project and copied it to the original location.
Want results from more Discord servers?
Add your server