打开数据库的问题 [英] problem with opening database

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

问题描述

朋友们。



i用C#和sql server 2008开发了一个软件。

我的连接字符串是 -

hi friends.

i have developed a software with C# and sql server 2008.
my connection string is--

@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ReminderDatabase.mdf;Integrated Security=true;User Instance=True;



我的数据库文件位于程序执行路径中并且已安装该计算机中的sqlexpress。我关闭了防火墙,用户可以完全访问db文件。现在,当我想用​​户登录软件时(按下登录按钮)发生错误,说数据库无法打开,因为它是版本661.此服务器支持655及更早版本。不支持降级路径。不能打开新数据库C:\program files \ ... \ comp\ ... \ mydatabase.mdf.create database is尝试为C:\ mysphath \ mydatabase.mdf附加自动命名数据库失败。存在一个同名的数据库,或者指定的文件无法打开,或者它位于UNC共享上。



如何解决这个问题。



感谢网友。


and my database files are in the program execution path and i installed sqlexpress in that computer. i turned off the firewall and users have full access to the db files. now when i want to user log into the software(with pressing login button) an error occurs that say database can not 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:\program files\...\comp\...\mydatabase.mdf. create database is aborted. an attempt to attach an auto named database for C:\mypath\mydatabase.mdf failed. a database with the same name exists, or specified file can not be opened, or it is located on UNC share.

how can i solve this problem.

thanks friends.

推荐答案

感谢answer.my数据库和我的程序都在一台计算机上。我做你没有使用网络
thanks for answer.my database and my program both are in one computer.i do not use network


你正在混淆使用LocalDB和SqlServer2008。



首先:.\SQLExpress指的是本地实例而不是服务器实例。替换。使用SQL服务器的IP地址是一个启动器。

第二:使用Catalog而不是AttachDBFileName。使用AttachDBFileName,您可以注册您的数据库。使用目录,您可以使用数据库。



位于共享上的错误似乎看起来像是在使用LocalDB而不是SQLExpress。因此,找出您使用的数据库,它在网络中的位置(LocalDB无法通过网络工作) - > IPADDRESS和您正在使用的目录(= DB名称)。

远程连接到Sql Server设置中的Db设置?



足以先照顾。
You are mixing up the use of LocalDB ans SqlServer2008.

First: .\SQLExpress refers to a local instance and not a server instance. Replacing the . with the IP address of the SQL server is a starter.
Second: Use Catalog in stead of AttachDBFileName. With AttachDBFileName you can register your db. With Catalog you use the db.

Error with Located on a Share seems to look like you are using LocalDB and not SQLExpress. So find out which db you use, where it is in the network (LocalDB does not work over a network) -> IPADDRESS and which Catalog (= DB Name) your are using.
Is remote connection to the Db setup in the Sql Server Settings?

Enough to look after first.


这篇关于打开数据库的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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