57333

Connect EF to SQL Server Management studio

Question:

I'm using EF code-first and I want it to create the new database in SQL Server Management Studio instance instead of using the integrated SQL Server in Visual Studio.

I added this to my web.config:

<connectionStrings> <add name="BillFo" connectionString="Data Source=SELANL293;Initial Catalog=Billfo;Integrated Security=True"/> </connectionStrings>

But it doesn't help. No nothing happens, nothing in the integrated SQL Server and nothing in my SQL Server Management Studio. How do I make it create my database in Management Studio rather then the SQL Server in Visual Studio?

Answer1:

try add this section

<entityFramework> <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"> <parameters> <parameter value="connection string......"/> </parameters> </defaultConnectionFactory> </entityFramework> <connectionStrings> <add name="..." providerName="System.Data.SqlClient" connectionString="......" /> </connectionStrings>

you do not have to use <parameters> property , you can use your currently connection string configuration

Answer2:

Try

<connectionStrings> <clear /> <add name="YourEFContextName" connectionString="Data Source=localhost\SqlServerInstanceName; Initial Catalog=DataBaseName; User ID=UserName; password=YourPassword; MultipleActiveResultSets=True;" providerName="System.Data.SqlClient" /> </connectionStrings>

The section entityFramework should be created automatically.

Recommend

  • Why is employee_id not being inserted into database
  • c# wcf hosted in windows service goes idle after 5 minutes
  • Why does opening a connection throw a distributed transactions error in MySQL? (.NET Connector)
  • uncommittable transaction is detected at the end of batch. the transaction is rolled back
  • Updating an Access Database via a DataGridView Using OLEDB in VB.NET
  • Login failed for user ''
  • Azure service bus paired namespace - simulate failover
  • With one EDMX file use multiple connection strings that relate to multiple databases
  • Can I disable IE compatibility mode only for content within a ?
  • Success handler not working after Symfony2 login
  • how to automatically enter password when using ssh?
  • DotNetOpenAuth - how to uniquely identify Google users?
  • Installing apk from within application in android
  • How can I create a plugin mechanism that calls functions only when the plugin is available?
  • Unique SMS sender id?
  • 3.0.0.M1: SSL - Invalid keystore format
  • Convert RSA pem key String to der byte[]
  • Local Development, Apache vs Developer - file permissions
  • Embedded Glassfish JPA Datasource connection fail
  • HttpListener.IsSupported is false on XP SP3
  • Enabling DTD support in Sql Server
  • MYSQ & MVC3 SQL connection error \\ ProviderManifestToken but I am using MySQL
  • GAE: Way to get reference to an HttpSession from its ID?
  • Does Mobilefirst provide a provision to access web services directly?
  • Nant, Vault & Windows Integrated Authentication
  • Counter field in MS Access, how to generate?
  • Javascript + PHP Encryption with pidCrypt
  • Websockets service method fails during R startup
  • trying to dynamically update Highchart column chart but series undefined
  • Why can't I rebase on to an ancestor of source changesets if on a different branch?
  • Angular 2 constructor injection vs direct access
  • Java static initializers and reflection
  • embed rChart in Markdown
  • Android Google Maps API OnLocationChanged only called once
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • How to Embed XSL into XML
  • How can I use `wmic` in a Windows PE script?
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • Conditional In-Line CSS for IE and Others?