localdb

What is the best way to attach existing database to sql localdb?

烂漫一生 提交于 2019-12-05 18:22:49
问题 Context I'm working on a desktop app which must be able to run in case of connection loss with the distant sql server : a SQL Server Express (I know...) 2012. I'm working on Visual Studio Express 2013. So I figured out that my best option is to use SQLLocalDB as my client local DB as I just have to import my data-free mdf file and handle the data synch (which represent a quite simple enough ruleset) by myself. To attach the mdf file to SQLLocalDB, I have two options but I do not understand

Change default location of LocalDb

♀尐吖头ヾ 提交于 2019-12-05 13:05:27
问题 I am programming with EF5-code first and want to use LocalDb. How can I change the default location of LocalDb database file? Default location is %USERPROFILE% directory according to http://blogs.msdn.com/b/sqlexpress/archive/2011/10/28/localdb-where-is-my-database.aspx Previously I was using SqlCe DbConnectionFactory which accepts a parameter for database path/name. If I use AttachDbFileName parameter then it raises an exception if database doesn't exist (it's supposed to create it!). 回答1: I

Login failed for user '' and Cannot open database “Database1.mdf” requested by the login. The login failed. Login failed for user 'rBcollo-PC\\rBcollo'

大憨熊 提交于 2019-12-05 12:51:05
So..I managed to almost finish all my problems.But now i deal with another one. I used this connectionstring : SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Database=Database1.mdf"); And it throws the next error: Login failed for user ' If i remove the .mdf extension it throws the same error Now if i'll add the following to the string: Integrated Security = true It throws this: Cannot open database "Database1.mdf" requested by the login. The login failed. Login failed for user 'rBcollo-PC\rBcollo'. P.S for Integrated Security = false it throws the "Login failed for user'"

Error when start an instance of SQLLOCQLDB 2017 on windows 7 64bit (entry point not found except)

拥有回忆 提交于 2019-12-05 09:00:48
I tried to start an instance of SQLLOCALDB 2017 on win7 (x64) but this message box Appears : "The procedure entry point BCryptKeyDerivation could not be located in the dynamic link library bcrypt.dll" Anybody knows it's reason? more info from CMD: Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\hashem-7-x64>SQLLOCALDB INFO MSSQLLocalDB C:\Users\hashem-7-x64>SQLLOCALDB VERSIONS Microsoft SQL Server 2017 (14.0.1000.169) C:\Users\hashem-7-x64>SQLLOCALDB START MSSQLLOCALDB Start of LocalDB instance "MSSQLLOCALDB" failed because of the

Visual Studio 2012 Code First still uses SQLEXPRESS by default

心不动则不痛 提交于 2019-12-05 06:12:31
I created a brand new Web API project, created a simple Code First model (one class with an id and the dbcontext object, and that's it), and ran Enable-Migrations in the package manager console. I noticed that it creates the database in SQLEXPRESS rather than LocalDB, despite the DefaultConnection string pointing to (LocalDB) in the Web.config file. This causes subsequent queries to fail, claiming that the database hasn't been initialized. How do I get the Enable-Migrations command in VS 2012 to point to LocalDB rather than SQLExpress? I've tried installing SQL Management Studio 2012 Express

Is LocalDB supported by Visual Studio 2010 in Entity Framework 5?

左心房为你撑大大i 提交于 2019-12-05 04:16:25
Is LocalDB supported by Visual Studio 2010 in Entity Framework 5, on .NET 4.0? Or am I doing it wrong? I'm getting a "The network path can't be found" issue when instantiating my model container with a connection string for LocalDB. Here's the connection string: var connectionString = "metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string=\"data source=(localdb)\v11.0;initial catalog=fablelane_com_db;integrated security=SSPI;multipleactiveresultsets=True;App=EntityFramework\""; Edit 1 I'm receiving the following error when

Does SQL Profiler work with LocalDB?

瘦欲@ 提交于 2019-12-04 23:27:27
问题 Is it possible to use SQL Profiler to observe queries being requested of a LocalDB instance? 回答1: You can use SQL Profiler just as you do with all other SQL editions as long as you know the proper server name. You can find the server name using the SqlLocalDb utility. To find it, use sqllocaldb info YourInstanceName to find the Instance Pipe Name . It has the form np:\\.\pipe\LOCALDB#12345\tsql\query Use this as the server name to connect to the server and start profiling 回答2: This is what I

Keyword not supported: 'data source'.: EF code-first using ObjectContext and LocalDB

╄→гoц情女王★ 提交于 2019-12-04 15:48:58
I am getting a "keyword not supported error" when I try to connect to a LocalDB database using ObjectContext. This is my connection string: <add name="connStr" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=proj1db;Integrated Security=True" /> and this is the code that tries to create an instance of the ObjectContext: var connectionString = ConfigurationManager .ConnectionStrings["connStr"] .ConnectionString; ObjectContext _context = new ObjectContext(connectionString); The last line throws System.ArgumentException: Keyword not supported:

Unable to connect to LocalDB with HeidiSQL

大城市里の小女人 提交于 2019-12-04 14:05:38
问题 I have been trying to connect to a localdb instance with the latest version (at this time) of heidisql to no avail. I have followed the instructions from this answer here but it doesn't seem to work (anymore): HeidiSql connection to MS SQL Server LocalDB I tried the following: 1) heidisql -d=LocalDB -h=%pipename% -n=3 -d=LocalDB 2) heidisql -d=LocalDB -h= np:\.\pipe\LOCALDB#41CF9FCB\tsql\query -n=3 -d=LocalDB (i realize that the number changes every time your start a new localdb instance) 3)

how does one programmatically create a localdb .mdf?

心已入冬 提交于 2019-12-04 12:22:36
how does one programmatically create a localdb .mdf? acceptable solutions exclude visual studio, ssms, aspnet_regsql. a naive stab at a solution might look like this: static void Main(string[] args) { using (var con = new SqlConnection(@"Integrated Security=SSPI;Data Source=(LocalDb)\v11.0;AttachDbFilename=test.mdf")) { con.Open(); using (var cmd = new SqlCommand("CREATE DATABASE test", con)) { cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } } } but of course, this fails in SqlConnection.Open with the error An attempt to attach an auto-named database for file test.mdf failed. A