aspnet_regsql question

DuNuNuBatman
DuNuNuBatman used Ask the Experts™
on
I am running sql express that came with my visual studio program. Anyway, I am trying to run aspnet_regsql on my machine but I keep getting an error.

Start adding the following features:
Membership
Profile
RoleManager

.
An error occurred during the execution of the SQL file 'InstallCommon.sql'. The SQL error number is 5133 and the SqlException message is: Directory lookup for the file "c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\C:\Users\Josh\Documents\Visual Studio Codename Orcas\Projects\DTC\Website\App_Data\DtcDatabase.mdf.mdf" failed with the operating system error 123(The filename, directory name, or volume label syntax is incorrect.).
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Creating the C:\Users\Josh\Documents\Visual Studio Codename Orcas\Projects\DTC\Website\App_Data\DtcDatabase.mdf database...
SQL Server: localhost\SQLExpress
Database: [C:\Users\Josh\Documents\Visual Studio Codename Orcas\Projects\DTC\Website\App_Data\DtcDatabase.mdf]
SQL file loaded:
InstallCommon.sql

Commands failed:

DECLARE @dbname nvarchar(128)
DECLARE @dboptions nvarchar(1024)

SET @dboptions = N'/**/'
SET @dbname = N'C:\Users\Josh\Documents\Visual Studio Codename Orcas\Projects\DTC\Website\App_Data\DtcDatabase.mdf'

IF (NOT EXISTS (SELECT name
                FROM master.dbo.sysdatabases
                WHERE name = @dbname))
BEGIN
  PRINT 'Creating the ' + @dbname + ' database...'
  DECLARE @cmd nvarchar(500)
  SET @cmd = 'CREATE DATABASE [' + @dbname + '] ' + @dboptions
  EXEC(@cmd)
END

SQL Exception:
System.Data.SqlClient.SqlException: Directory lookup for the file "c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\C:\Users\Josh\Documents\Visual Studio Codename Orcas\Projects\DTC\Website\App_Data\DtcDatabase.mdf.mdf" failed with the operating system error 123(The filename, directory name, or volume label syntax is incorrect.).
CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
Creating the C:\Users\Josh\Documents\Visual Studio Codename Orcas\Projects\DTC\Website\App_Data\DtcDatabase.mdf database...
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at System.Web.Management.SqlServices.ExecuteFile(String file, String server, String database, String dbFileName, SqlConnection connection, Boolean sessionState, Boolean isInstall, SessionStateType sessionStatetype)

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
I'm still getting the same error.
Please give the statement that you run with complete file name
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Author

Commented:
aspnet_regsql -A mrp -C "Data Source=.\SQLEXPRESS;Integrated Security=True;User Instance=True" -d "C:\Users\Josh\Documents\Visual Studio Codename Orcas\Projects\DTC\Website\App_Data\DtcDatabase.mdf"

Author

Commented:
alright, I figured it out. When I tried to attach the database using sql server management studio, I noticed I couldn't browse past the C:\Users\Josh directory. I then tried to manually put in the path to the mdf file and got the same error. So I changed the permissions to my users directory and sub dirs and that fixed it. So I was just having some weird permissions issues.
Anyway, it ran, problem solved. Thanks for the help!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial