解决方案——Connect to an old database using LocalDB in VS
来源:互联网 发布:mac系统游戏 编辑:程序博客网 时间:2024/05/21 08:10
解决无法在高版本VS中连接低版本SQlServer数据库文件的问题
当我们尝试在高版本VS中将一个低版本SQLServer数据库文件添加到模型中的时候,可以会得到这样一个提示:
This database file is not compatible with the current instance of SQL Server. To resolve this issue, you must upgrade the database file by creating a new data connection, or you must modify the existing connection to this database file. For more information, see http://go.microsoft.com/fwlink/?LinkId=235986
然后我们又不得不发现Microsoft上得不到直接有用的解决方案。
其实我们可以这样做:
1.打开SQL Server Management Studio,添加目标数据库文件。
2.在VS中打开Server Explorer(View -> Server Explorer),新建数据库连接至刚刚导入SQLServer的库,Server name置为(localdb)\v11.0
。
3.点击我们刚刚添加的Data Connection,选择Properties,将Connection String的值替换Web.config中的数据库连接信息。
4.在Models文件夹中添加Models,选择我们刚刚建立的连接信息,发现可以成功了!
以下引自stackoverflow原文:
1.Forget about trying to open the old SQL Server Express .mdf file in Visual Studio 2012. During the conversion process of an old VS 2010 solution to VS 2012 it tells you can do that by just double clicking the database file and upgrade it to use LocalDb instead. That’s a complete lie! :D
2.Open SQL Server Management Studio, select the Databases node, right click it and select Attach….
3.Provide the path for the .mdf file, click OK and then you should be good to go.
4.Now inside Visual Studio 2012, open Server Explorer (menu View -> Server Explorer), right click Data Connections and then select Add Connection…. In Server name: put (localdb)\v11.0 and in Connect to a database: select the database you attached previously.
5.Right click the Data Connection just added in Solution Explorer and select Properties. Copy the Connection String property and replace the Web.Config or App.Config one with this value.
——see here
- 解决方案——Connect to an old database using LocalDB in VS
- Connect to localdb in Visual Studio 2015
- How can I connect Unity to an SQL database in order to implement an MMO?
- Connect to LocalDB in Visual Studio Server Explorer
- Connect to an Oracle database with JDBC
- Connect to an Oracle database with JDBC
- mysqlnd cannot connect to MySQL 4.1+ using old authentication
- How to connect to another database using sqlplus?
- Connect to Dababase using JDBC in JSP
- Using Timer to get history values from EDNA database, an error is prompted in the page : "Sys.WebForms.PageRequestManagerTimeout
- SAX used in java to connect to database
- php 5.3:connection failed:SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using old auth
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication问题解决
- mysqlnd连接数据库的问题(mysqlnd cannot connect to mysql 4.1+ using old ..)
- mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
- Warning: mysql_connect(): mysqlnd cannot connect to MySQL 4.1+ using the old insecure authenticat
- php连接MySQL时产生错误:mysqlnd cannot connect to MySQL 4.1+ using old authentication
- 基于特定值来判断隐藏显示元素的jQuery插件
- 计算机是如何工作的?(总结)——三个法宝
- android UI设计的一些心得与问题解决(无效果图)
- Web Storage 数据存储
- Codeforces 487B. Strip DP+线段树+二分
- 解决方案——Connect to an old database using LocalDB in VS
- ejabberd安装步骤+Mysql配置
- MySQL死锁问题实例分析及解决方法
- [LeetCode刷题记录]190-191 Number of 1 Bits & Reverse Bits
- 使用404被动生成缩略图
- CloudFlare resources and downloads
- 内存映射文件
- VC中句柄、指针、ID之间的转换
- 网络工程师枕边书:精选30本图书抢先读