Cant connect to Database. Visual Studio 2013 aspx [duplicate] - c#

This question already has answers here:
The database cannot be opened because it is version 706. This server supports version 655 and earlier. A downgrade path is not supported
(4 answers)
Closed 9 years ago.
I have Visual Studio 2013, and SQL Server 2008 and 2012. They both support my computer. My database was created in VS2012 and i cant open it in VS2013. I installed all the tools that there is in VS2012. I tried to have a connection string in the Web.config. Everytime Im trying to send some data to my database, i get this message:
The database 'C:\USERS\XXXX\DESKTOP\XXXXX\APP_DATA\DATABASE.MDF'
cannot be opened because it is version 706. This server supports
version 662 and earlier. A downgrade path is not supported. Could not
open new database
'C:\USERS\XXXX\DESKTOP\XXXXX\APP_DATA\DATABASE.MDF'. CREATE DATABASE
is aborted. An attempt to attach an auto-named database for file
C:\Users\XXXX\Desktop\XXXXX\app_data\DataBase.mdf failed. A database
with the same name exists, or specified file cannot be opened, or it
is located on UNC share.
http://i.imgur.com/ioXgagk.png
What can I do next?
Thanks.

You can't open a database created for Sql Server 2012 with Sql Server 2008. To make this work, you need to open the database in Sql Server 2012 and change the compatability level from 110 (Sql Server 2012) to 100 (Sql Server 2008 and Sql Server 2008 R2). Hopefully you haven't used any features of Sql Server 2012 that will prevent this change.

Related

I always get this error. what should i do?

The database 'C:\USERS\ROANEPC\DESKTOP\FINAL\BROADCASTWEB\APP_DATA\ASPNETDB.MDF' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported.
Could not open new database 'C:\USERS\ROANEPC\DESKTOP\FINAL\BROADCASTWEB\APP_DATA\ASPNETDB.MDF'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file C:\Users\RoanePC\Desktop\Final\BroadcastWeb\App_Data\ASPNETDB.MDF failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
Database version:
655 means SQL Server 2008 instance.
661 means SQL Server 2008 R2 instance.
684 means SQL Server 2012 CTP1 instance.
706 means SQL Server 2012 instance.
782 means SQL Server 2014 instance.
You'll need to install the R2 version and continue to use that version. Downgrades do not work as in your example from 2008 R2 (10.50) to 2008 (10.00) but you can upgrade versions.

Visual Studio keeps asking to install SQL Server

I am using Visual Studio 2012 working on a web application, a registration page. I have installed SQL Server 2008 Express and done the configuration but still when when I try to add a SQL Server database file in the project, I get an error
Connection to SQL Server Database file (.mdf) requires SQL Server 2005 or SQL Server 2008 Express to be installed and running on you local computer
Please help I am stuck here.
You need to install the LocalDB or to change your connection string to use the SQL server you have installed, it seems like you are trying to use a MDF file.

Error 948 :Visual Studio 2012 with SQL Server 2008 R2

I have a computer that working as server and client machine. I installed SQL Server 2008 R2 and Visual Studio 2012 in it.
Using SQL server management studio I generated a DB then I created few table in that DB , then I insert data into it.
Then I deattached that DB using Server Management studio . Then I move that DB into my project "App_Data" folder.Then using "server explorer" & T_SQL pane functions of Visual Studio 2012 I did few changes of that DB .
Since I want to do massive changes , I close that DB connection with the project. I move that DB into SQL server default Database Location which is
"C:\Program Files\Microsoft SQL
Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA"
then I try to attach that DB using server management studio , I'm getting
"Error 948"
Cannot be opened because it is version 706. This server supports
version 661 and earlier
How to overcome this error ? your ideas/suggestions highly appreciate
By default, you can't attach a DB file from a SQL Server 2012 to an instance which is running SQL Server 2008 R2.
Version 661 is a SQL Server 2008 R2 DB file and version 706 is a SQL Server 2012 DB file. More information: How to determine version of Local Sql Instance and your database
You will therefore need to update your SQL Server instance, e.g. by upgrading to SQL Server 2012
I would also recommend you patch to the newest released build of SQL Server 2012. Check here for the newest version numbers for the different SQL Server versions: Microsoft SQL Server Version List
its a version comparability issue.
Initially you created in sqlserver 2008 R2 that version would be 661 and when you moved to VS2012 it was updated to 706, and when you tried to go back to SQl server 2008 R2 again this 706 version is not being downgraded to 661, obviously it can't be done.
one simple solution without any changes to your server setup, use Generate Script feature that should help you.

How to connect SQL Server 2012 Database created with SSMS to Visual Studio 2013 [duplicate]

This question already has an answer here:
updating a service based database in windows form(2) [closed]
(1 answer)
Closed 8 years ago.
I am using SQL Server Management Studio for the first time. I have created a project and I created one database in it. How can I connect that database to Visual Studio 2013.
If I go to Tools -> Connect to Database
I get this
Then after selecting Microsoft SQL Server I browse to my database and I am getting this
What should I do???
If you have already added the database to your Sql Server you can't select Attach a Database file and then Browse for the same MDF file already added to Sql Server. Instead you choose Select or enter a database name and select the logical database name from the list proposed.

C#.net db connection with sql server 2005 MDF file

After creating the setup file in c#.net WPF application, couldnot connect with the sqlserver 2005 MDF file.
The setup file is including the sqlserver MDF file.
plz tell me, what is connection problem?
Just a wild guess (see comments on your question): You're trying to use the "user instance" feature that was introduced in SQL Server 2005? Then the SQL Server 2005 needs to be installed on the target machine as well - maybe only the Express edition. As long as you don't install the SQL Server there's no way you get a connection to your shipped MDF file.

Categories