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 trialEzequiel Hurt
8,061 PointsSQL Unhandled Exception
I was following the example. Every was fine, but when I build and run the project, I have an exception.
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in EntityFramework.dll
Additional information: CREATE DATABASE permission denied in database 'master'.
2 Answers
James Churchill
Treehouse TeacherEzequiel,
Sounds like your user account doesn't have the correct permissions to create a new database. What does your development environment look like? What versions of Visual Studio do you have installed? Have you installed a version of SQL Server as well?
Thanks ~James
Ezequiel Hurt
8,061 PointsHi James, thanks for your answer. It's like you guess. I saw on the SQL Server Explorer the instance of SQL EXPRESS, and the local DB. I went to Tools -> Options -> Database Tools -> Data Connection and on field SQL Server Instance Name I deleted the localDB and left in blank. Then I add the string to app.config. I think with the string I'm forcing visual studio to use the LocalDB. For the time being, its ok.
Best regards.- Ezequiel
Ezequiel Hurt
8,061 PointsEzequiel Hurt
8,061 PointsJames, thanks for your answer. I don't know why is trying to connect to master db. I continued the course and declare the string connection on the app.config and the problem was solved automatically.
Best regards, Ezequiel.
James Churchill
Treehouse TeacherJames Churchill
Treehouse TeacherConnecting to the master database is necessary to do in order to create a new database. When you explicitly provide a database connection string, are you specifying LocalDB to be your database server? If so, my guess is that you might have SQL Server Express installed (in addition to LocalDB) and your Windows user account isn't assigned to the correct SQL Server group so you can't access Express' master database.