Abhilash V Abhilash V - 1 month ago 8x
SQL Question

Database created from Code first shows in Server Explorer and not in SQL Server Object Explorer

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

<add name="Db"
connectionString="Data Source=ABHI\SQLEXPRESS;Integrated Security=True"
providerName="System.Data.SqlClient" />


public class Db : DbContext {
public Db() : base("name=Db") { }
public virtual DbSet<Blog> Blogs { get; set; }
public virtual DbSet<Post> Posts { get; set; }


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"/>