Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8510983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:51:37+00:00 2026-06-11T03:51:37+00:00

The Entity Framework will not create my database when using SQL Express but it

  • 0

The Entity Framework will not create my database when using SQL Express but it works fine if I use SQL Server CE.

I have been trying to figure this out for a couple of days now, but it is probably my inexperience with ASP.NET and MVC.

 ConnectionStrings:
<connectionStrings>
    <!--
    <add name="CRM"
         connectionString="data source=|DataDirectory|CRM.sdf"
         providerName="System.Data.SqlServerCe.4.0" />-->

    <add name="CRM"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\CRM.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />

    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
  </connectionStrings>

StackTrace:

System.InvalidOperationException was caught
  Message=Unable to complete operation. The supplied SqlConnection does not specify an initial catalog.
  Source=System.Data.Entity
  StackTrace:
       at System.Data.SqlClient.SqlProviderServices.GetDatabaseName(SqlConnection sqlConnection)
       at System.Data.SqlClient.SqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection)
       at System.Data.Objects.ObjectContext.CreateDatabase()
       at System.Data.Entity.Internal.DatabaseOperations.Create(ObjectContext objectContext)
       at System.Data.Entity.Database.Create()
       at System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context)
       at System.Data.Entity.Internal.InternalContext.<>c__DisplayClass5.<PerformDatabaseInitialization>b__3()
       at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
       at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
       at System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c)
       at System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input)
       at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action)
       at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
       at System.Data.Entity.Internal.InternalContext.Initialize()
       at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
       at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
       at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
       at System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
       at System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
       at System.Data.Entity.DbSet`1.Add(TEntity entity)
       at MvcApplication1.Controllers.CustomerController.Create(Customer customer) in C:\Users\hlcole\Documents\RegProjects\MvcApplication1\MvcApplication1\Controllers\CustomerController.cs:line 55
  InnerException: 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:51:39+00:00Added an answer on June 11, 2026 at 3:51 am

    Just as it says, you’re not supplying an Initial Catalog=__name__ in your connection string.

    SqlCe is a local file spun up for the purposes of the application–there are no multiple databases involved. However, SQLEXPRESS can host and offer multiple databases making supplying the Initial Catalog imperative.

    Add the following to your connectionString:

    ;Initial Catalog=__name__
    

    Where __name__ is the name of the database you want to use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Entity Framework code-first. I have a table the will not exceed
I am using Entity Framework 4.0, C# 4.0, .Net 2010 and SQL Server 2008
I have the following 2 tables defined in a SQL Server database: CREATE TABLE
Entity framework is cripplingly slow so I tried using a stored procedure but I
.Net4 Entity Framework, N-Tier (so objects are detatched) I have 2 objects generated Database
Background We have a WinForms application with Entity Framework 4.2 code-first / FluentAPI using
We are using ado.net entity framework 4.0 for our database layer and I am
I've recently started using Entity Framework migrations and noticed that the database name is
I'm using Entity Framework, and I have a COMMENT entity. A COMMENT has a
I have .NET MVC 3 project where I use sql membership provider and entity

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.