Reputation: 329
Database 'EFCheck' (Created by Entity Framework code first) is showing in Server Explorer and not in SQL Server Object Explorer and I'm not seeing the created database in my SQL Server. Can anyone tell me where I can see the new db in SQL Server ?
Server Explorer where I see the new EFCheck db created by EF
SQL Server Object Explorer where I don't see the EFCheck db
My connection string in Web.Config
<connectionStrings>
<add name="Db"
connectionString="Data Source=ABHI\SQLEXPRESS;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
DbContext
public class Db : DbContext {
public Db() : base("name=Db") { }
public virtual DbSet<Blog> Blogs { get; set; }
public virtual DbSet<Post> Posts { get; set; }
}
Upvotes: 2
Views: 631
Reputation: 65958
You didn't specify the Initial Catalog
in your connection string.You have to set the Initial catalog
as shown below.
<add name="Db"
connectionString="Data Source=ABHI\SQLEXPRESS;
Initial Catalog=Your-Db-Name-Should-Be-Set-Here;
Integrated Security=True" providerName="System.Data.SqlClient"/>
Upvotes: 2