I have SQL Server 2014 installed and want to use localdb\v12.0 in Visual Studio. I found this post and understand how to connect to localdb using SQL Server Object Explorer successfully. Now I have created a LightSwitch project in Visual Studio 2013 and when building it throws exception:
An error occured while establishing a connection to SQL Server
instance '(LocalDB)\v11.0'.
Seems it is looking for SQL Server 2012 to create the development database in Bin\Data and I don't have SQL Server 2012 so there is no localdb\v11.0 on the system. So
Why does VS 2013 try to use localdb\v11.0?
How can I force Visual Studio to use localdb\v12.0 when building the project?
I tried changing the _IntrinsicData connection string in web.config but when building again it throws the same exception trying to use localdb\v11.0 which belongs to SQL Server 2012!
Ok after spending lots of time I found what was the problem! Here is the cause and solution:
LightSwitch uses SQL Express LocalDB to store information such as User and Roles when building the project (this is called development database). There is no problem with SQL Server 2012 but if SQL Server 2014 is installed something force the LightSwitch to connect to (localdb)\v11.0 . LightSwitch makes three projects in the solution. If the Client and the Server projects build successfully so the problem is with the third project. Go through these steps:
Right-Click on the third project in the solution
Select Unload Project
Again Right-Click on it and select Edit <yourProjectName>.lsxtproj
Search the SqlExpressInstancename
You will find its value is (localDB)\v11.0 !
Change it to the right SQL Server LocalDB instance name; for more information check the notes below
Now the solution successfully build
--
Note 1: To see which version of SQL Server LocalDb is installed, open cmd and type sqllocaldb.exe v
Note 2: To which instance of LocalDb has been created on the system, open cmd and type sqllocaldb.exe info
Note 3: The instance which is going to be used by LightSwitch must be started: open cmd and type sqllocaldb.exe start
UPDATE: Looking for a better solution I found the correct way to fix this problem. It was a pain for me to follow those 6 steps every time I create a new LightSwitch project. So if you want to fix it once you can do it this way:
In Visual Studio go to Tools->Options
In the Database Tools select the Data Connections
Set your desired SQL Server Instance Name
So no need to set it every time you create a LS project
Related
I have created a c# visual studio application that uses SQL LocalDB 2016 for its database. Visual studio only allows 2012 to be used as a prerequisite, but I was able to find a 2016 download online. I have tried both SQL LocalDB 2016 and 2017, but get the same error for both.
A network related or instance specific error occurred while establishing a connection to SQL Server. Ther server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. ... error 50...Cannot create an automatic instance.
I have ran sqllocaldb i on cmd and the result was MSSQLLocalDB which is the automatic instance for SQL LocalDB. The connection string in visual studio is set up for MSSQLLocalDB. I have uninstalled all other versions. The only thing I can think of that could be causing a problem is permissions. Thanks
I'm trying to create a database-first ASP.NET MVC app with Entity Framework in Visual Studio.
Starting with a blank project template, I open up the Server Explorer and try to add a data connection. I use Microsoft SQL Server as the Data Source, and "(localdb)\v11.0" as the Server Name. This gives me the error:
"The Data Source value in the connection string specifies an instance
of SQL server that is not installed. To resolve the issue, either
choose to install the matching instance of SQL Server or modify the
Data Source value in the connection string."
The tutorial I'm following (and a few other places I've googled) mentions that localdb is installed with Visual Studio. Either way, I have also installed LocalDB found here but it's not showing up.
I've tried following the directions in this post, but get the error "Cannot create an automatic instance."
How do I get Visual Studio to connect to LocalDB?
The default instance name is changed to (localdb)\MSSQLLocalDB independent of version numbers for VS 2015.
More info here: http://thebillwagner.com/Blog/Item/2015-02-05-VersionindependentlocalDBinVisualStudio2015
I am trying to add a SQL Server database item into my ASP.Net website.
I have SQL Server 2012 installed but when I press add in Visual Studio I get the following error
Connection to SQL server database files (.mdf) require SQL Server 2005 Express or SQL Server 2008 Express to be installed and running on the local computer. The current version of SQL Server Express can be downloaded and at the following at the following URL: "
I am wondering if I can get it to work with 2012 in the way it would with 2005/2008 or will I need to download 2005/2008 to get this feature?
I only ask because it seems a little strange that VS2013 is not not compatible with SQL Server 2012...
PS: I am trying to follow the following tutorial and that is why I am hoping to get this to work so I can follow the tutorial as intended. "http://www.youtube.com/watch?v=Tyr1YXpNOrk"
by SQL Server Management Studio create your database, then in vs 2013 asp.net project use this database into web.config file
in vs 2013 and Server Explorer tab and Data Connections with Add Connection or Create new sql server database use from your db or create new sql 2012 db
I am wondering if i can get it to work with 2012 in the way it would with 2005/2008
What for? To my knowledge that was retired for the bad issues it created.
Visual Studio 2013 comes with an ad job user version of MSSQL (localdb) that is non-install-required and used in case.
Otherwise install the normal sql server and reate the db - do not rely on this functionality (like most non-trivial shops anyway) and no problem arises to start.
Yes It can be done through Visual studio and here is the link to guide A-Z
It will IIS to deploy ASP site.
http://www.asp.net/mvc/tutorials/older-versions/models-(data)/creating-model-classes-with-linq-to-sql-cs
Hope this will work as it worked for me
In the past I used to install Ms SQL 2005 in my system separately but in recent years I never care to use them anymore as I totally depend on XML tables rather than those of Ms SQL. So I never had the need for installing them.
Today, I thought of trying out using Ms SQL 2005 again in my ASP.NET project as many people suggest that its far more better than XML tables.
When installing Ms Visual Studio 2008 Professional Edition, it seems some controls of Ms SQL 2005 is included. What I could see from the "All Programs" (from start menu) is the Microsoft SQL Server 2005 Folder. Inside, I have Configuration Folder only.
Now on my Visual Studio Project, My "Server Explorer" looks like the image below.
I cannot create a database by right-clicking the Data Connection. I always get an error same as the one I get when trying to add "New connection" by clicking on "Add Connection".
Let me show you how I did using images:
Step 1: Choosing the Data Source
Q 1: Are the data source shown here are installed on my system or just the names shown by Default even if its not installed?
Step 2: Connecting to Microsoft SQL Server
The Error says: "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provide: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
Q 2: What does this mean?
My suspicion is that, this error occurred because I don't have SQL Server and my problem will be solved once I install SQL Server.
My curiosity is that, if SQL Server Database can be used even without installing SQL Server separately then why not just use it from here (Visual Studio) as some features seems to be already installed while installing Visual Studio.
Thank you for your time for caring to help me
Q1: That list does not show existing datasources, it shows available ADO.Net providers (you can think of them as database drivers).
Q2: Why did you enter "Me" as server name; is this the name of your computer? Try ".", "localhost" or "localhost\SQLEXPRESS" instead.
If you want to connect to SQL Server on your local machine, it needs to be installed on your local machine. The features installed as part of visual studio are front end management tools (depending on the version of Visual Studio installed).
Also, check out the version of SQL Server you're using for supportability purposes.
http://www.microsoft.com/en-us/sqlserver/support/support-updates.aspx
Those data sources shown in the image in Step 1 are not specific sources, they are simply types of sources. The Add Connection dialog you're looking at allows you to create a connection to, in the case that you selected Microsoft SQL Server, any MS SQL server you have access to connect to. Thus, your exact question: yes, what VS installs are simply drivers to connect to various databases, not the actual databases themselves.
Since you aren't running a MSSQL Server on your local machine, it tries to connect to your local machine to find a MSSQL server, can't, and thus gives that message. If you want to connect to a MSSQL server without installing one on your local machine, you could always find one someone else had installed on their machine and see if you could use it...
How can I connect to a database in Visual Studio with Entity Framework?
I have a database:
But in visual studio I don't know what I must enter.
I have a window:
Can You say what I must write there?
I tried many times and I still have error.
A dot (aka period), like this: .
If you have SQL Server Express installed, it should be .\sqlexpress
Use the Server explorer. See http://msdn.microsoft.com/en-us/library/x603htbk.aspx
You can choose the instance name when you install SQLServer Enterprise or SQLServer Express. I think it is the same for other database.
In the other hand, you can add a new database just in Visual studio project. Then you will get a MDF file in the resources list, which can be added here.
I don't know if I understood you, but those fields are about the server where the database is
Server name is the name o the server that appears on SQL Managment Studio (probably the name of the machine the server is running on)
When you open SQL Server Management studio you can a popup as shown below:
The server name that you use there should be the one you can use in your case. If the SQL Server database is installed on your machine it would be (local) or your machines name which can be found by right clicking on "My Computer" and then Properties and you can see "Computer Name" in the window that opens.