Click here to Skip to main content
15,893,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So I am trying to setup an Entity framework app, however I am having some difficulty. The connection information in the App.config looks like.

XML
<connectionStrings>
    <add name="CVEContext" providerName="System.Data.SqlClient" connectionString="data source=.\SQLEXPRESS;Initial Catalog=cvedb; user=cvepoc; Password='#'; Integrated Security=SSPI"/>
  </connectionStrings>


My DbContext class looks like.

C#
public class CVEContext : DbContext
   {
       public DbSet<CveEntity> CveEntities { get; set; }



       public CVEContext()
           : base("name=CVEContext")
           {
               Database.SetInitializer<CVEContext>(new CreateDatabaseIfNotExists<CVEContext>());
           }


   }


The interesting thing, here is the connection information should not work. The password is wrong, however, I consistently get an error message stating that "Create Database password denied in master"

Suggestions?
Posted
Comments
Maciej Los 18-Mar-15 15:11pm    
Are you trying to connect to the SQL Server database on Windows CE? I'd suggest to remove this part: Integrated Security=SSPI
See: http://www.connectionstrings.com/sql-server/
CdnSecurityEngineer 18-Mar-15 15:16pm    
Either way it doesn't seem to matter.
Maciej Los 18-Mar-15 15:25pm    
So, what's matter?

1 solution

CdnSecurityEngineer wrote:

Integrated Security=SSPI

That setting tells the connection to ignore the username and password specified, and connect using Windows authentication. It doesn't matter that the password is wrong, because it's never used.
http://www.connectionstrings.com/sql-server/[^]

The error message is telling you that the database cvedb doesn't exist, and your Windows account doesn't have permission to create it. Try running the application elevated, which should give you the necessary permissions.
 
Share this answer
 
v2
Comments
Maciej Los 18-Mar-15 15:46pm    
You stole my answer ;)
See my comment to the question.
+5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900