troubleshooting Question

aspnet_regsql question

Avatar of DuNuNuBatman
DuNuNuBatman asked on
.NET ProgrammingC#ASP.NET
6 Comments1 Solution1258 ViewsLast Modified:
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)

ASKER CERTIFIED SOLUTION
Fareed Ali Khan

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros