Kira Borke
Kira Borke

Reputation: 55

Inability to create a database in C# Visual Studio

I have created a project in Visual Studio using a Windows Form application C#.

However when I try to add a service-based database to the project the following message appears:

The file \\(file name has not been included for privacy reasons)\mydocuments\visual studio2010\Projects\Experiment\Experiment\Experiment.mdf is on a network path that is not supported for database files. CREATED DATABASE failed. Some file name listed could not be created. Check related errors. User does not have permission to alter database. ‘FF557489-6500-4C96-86DA-B07E7615056D’, or the database does not exist. ALTER DATABASE statement failed. User does not have permission to alter database ‘FF557489-6500-4C96-86DA-B07E7615056D’, or the database does not exist. ALTER DATABASE statement failed. The database ‘FF557489-6500-4C96-86DA-B07E7615056D’ does not exist. Supply a valid database name. To see available databases, use sys.databases.

(I would have included a picture of the error but Stackoverflow insists I have 10 reputation points before I am allowed to included images in a post).

Has anyone encountered this before and know a way around it?

Upvotes: 1

Views: 371

Answers (3)

Parag Meshram
Parag Meshram

Reputation: 8511

As per MSDN, Permissions to Create or Deploy a Database -

  1. Import database objects and settings
  2. Import server objects and settings
  3. Create or update a database project.
  4. Deploy new database or deploy with Always Re-create Databaseoption set
  5. Deploy updates to an existing database
  6. Use an assembly with the EXTERNAL_ACCESS option in a database project
  7. Deploy assemblies to a new or existing database

Please refer - Permissions to Create or Deploy a Database on MSDN

Upvotes: 0

Keith Nicholas
Keith Nicholas

Reputation: 44288

critical part of your error message "is on a network path that is not supported for database files"

try making sure its on the local disk.

Upvotes: 1

paulsm4
paulsm4

Reputation: 121599

Recommendations:

1) Verify you can connect to your MSSQL database instance

2) Simply issue "create database MYDATABASE". Let MSSQL decide where to put the files (you'll have a database file and a corresponding database log file).

IMHO...

Upvotes: 0

Related Questions