0

I'm trying to define a connection string for EF code-first approach to generate the database in SQL Server Express.

I'm logging into my pc using /user account, once I put following connection string in web.config file in my WebAPI project

<connectionStrings>
    <add name="libraryappconnectionstring" 
         connectionString="Data Source=minchiepad\SQLEXPRESS;Initial Catalog=LibraryAppDB;Integrated Security=SSPI;" 
         providerName="System.Data.SqlClient"/>
</connectionStrings>

I can see its listing under server explorer tab

enter image description here

When I try to connect I'm getting following error

enter image description here

Once I googled, all the related answer for this errors are for existing DBs

enter image description here enter image description here enter image description here

Where should I configure to fix that error connection string or SQL Server? And how?

kez
  • 2,273
  • 9
  • 64
  • 123

1 Answers1

0

One of the possibility is user don't have access to the DB you attempting to access.

Check these settings.

enter image description here

Try changing the Default Database to LibraryAppDB in General Properties

I can see Space in the username at first, does local user has same name. Check is that causing any issue by any means.

Check "user mapping" to know the DB access allowed to this user.

  • Yeah this one same – kez Sep 11 '16 at 04:19
  • I have refer here user properties not the DB properties, in general setting its showing login users name, cannot setup user mapping since DB not generated yet – kez Sep 11 '16 at 08:26