Click here to Skip to main content
14,491,551 members
Rate this:
Please Sign up or sign in to vote.
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.

<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.

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

Rate this:
Please Sign up or sign in to vote.

Solution 1

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.
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100