SQL Server数据库连接错误 [英] SQL Server Database Connection Error

查看:78
本文介绍了SQL Server数据库连接错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我有两个问题,第一个是如何使用visual basic附加一个位于我的应用程序文件夹中的sql server数据库。净?当前代码非常基本lol ...



Database = Server-PC\SQLEXPRESS; Initial Catalog = SQLDatabaseFile; Trusted Connection = True



第二个问题是最重要的,在我的系统上,我运行Win 7 x64,SQL Server 2008 Developer并使用Visual Studio 2012进行编程。



我的第二个问题是,一旦我运行我的应用程序并尝试连接到我在SQL Server Management Studio中创建的预先设计的数据库,我就会收到以下错误...



SQL Server实例在登录协商期间返回了无效或不支持的协议版本,是否有解决此问题的方法,其中不包括升级我的sql server management studio或sql服务器到2012,如插件或次要代码更改?



提前致谢

解决方案

第一个问题答案...



<前lang =cs>服务器=。\ SQLE随心; AttachDbFilename = C:\MyFolder\MyDataFile.mdf;数据库= dbname;开发
Trusted_Connection =是;







第二个问题答案......



我玩了目标框架,并发现SQL Server 2008开发人员和快递与.Net framework 4.5及更高版本不兼容......解决方案是设置目标框架我正在开发的应用程序.Net Framework 3.5。


Hi guys

I have two questions, first one would be how would I go about attaching an sql server database which is located in my application folder using visual basic .net? The current code that have is very basic lol...

"Database=Server-PC\SQLEXPRESS;Initial Catalog=SQLDatabaseFile;Trusted Connection=True"

The second question is the most important of all, On my system I am running Win 7 x64, SQL Server 2008 Developer and programming using Visual Studio 2012.

My second question is, once I run my application and try to connect to a pre-designed database that I created in SQL Server Management Studio, I get the following error...

"The SQL Server Instance returned an invalid or unsupported protocol version during login negotiation", Is there a solution to this problem which does not include upgrading my sql server management studio or sql server to 2012 such as a plugin or minor code change?

Thanks in advance

解决方案

First Questions Answer...

Server=.\SQLExpress;AttachDbFilename=C:\MyFolder\MyDataFile.mdf;Database=dbname;
Trusted_Connection=Yes;




Second Questions Answer...

I played around with the target framework and figured it out that SQL Server 2008 developer and express is not compatible with .Net framework 4.5 and higher... The solution is to set the target framework of the application I am developing to .Net Framework 3.5.


这篇关于SQL Server数据库连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆