Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# Entity Framework Basics Entity Framework and Databases Changing the Database Name

Entity Framework Basics: When I run the app it does not write line the series title.

When I add a break point it looks like it skips the context.ComicBooks.Add(new ComicBook() section. When I first ran the program it did not write the title, so i added a break, stepped into, and it worked. now after i deleted the database in a previous vid it will not step into this part where it adds the title. it will not create a new database in the sqllocaldb explorer either.

Hamza Qaisrani
Hamza Qaisrani
1,161 Points

Could you please post your code so that it's easier to analyze and find the bug.

There is a lot of code. I could not wait, so even though it does not run properly I am moving forward with the lesson. It is just not creating the database. My code is the same as the lesson code. So there is something else not permitting the database to be created. I can even start with one of the sln files from the downloaded set and it will not create the database within VS. So this is probably not a code issue.

I'll get through the course. I just figured I would not have been the only one to have this issue.

K Cleveland
K Cleveland
21,839 Points

Do you have localDB installed? To check, open your command prompt and type: sqllocaldb. What does it say?

4 Answers

Hamza Qaisrani
Hamza Qaisrani
1,161 Points

I would suggest the same as Keaunna.

However I was also having the same issue with localDB and SQL server installed.

I then realised that once I run the console app. I had to wait for a few seconds (5-10), before it displayed the title.

K Cleveland
K Cleveland
21,839 Points

Yes @ Hamza, that happened to me as well. :)

YES, Hamza is correct. I have localDB and SQl server installed. I just waited over 10 seconds and it created the database and ran like it should.

THANKS Hamza Qaisrani!

Hamza Qaisrani
Hamza Qaisrani
1,161 Points

Awesome! Glad to hear Jason!

Alec Meyer
Alec Meyer
6,303 Points

Like others have said, it takes a while. Also make sure you don't have the extra '\' if you are using the app.config method.

Thanks for the tip! It helped me! However, I would also like to add that I did not see the database appear in the databases folder inside SQL Server Object Explorer because I failed to REFRESH the screen! (not proud of that one...) Hope this helps someone...