数据库和家庭网络C# [英] database &homenetwork& C#

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

问题描述

大家好
我在Labtop和PC之间建立了家庭网络
笔记本电脑的系统是Vista,而PC的系统是Windows xp
我将sql数据库文件放在了PC硬盘的共享目录中
共享完全可以控制"
我在c#visual studio 2005项目中进行了访问,以访问该数据库
当我在笔记本电脑上运行它时
但是在C#visual studio 2005中,当我找到sql文件并按"testconnection"时,它给了我以下错误:

文件"sniper \\ c \ xx \ xx.mdf"在数据库文件不支持的网络路径上.
尝试为文件"sniper \\ c \ xx \ xx.mdf"附加自动命名的数据库失败.存在具有相同名称或未打开指定文件或位于UNC共享上的指定名称的数据库"

这样任何人都可以帮助我
Thank

hi every one
i made home network between my labtop and pc
the laptop''s system is vista and pc''s system is windows xp
i putted sql database file in shared directory in pc hard disk
"the sharring is full control"
and i made in c# visual studio 2005 project to access this database
when i run it in the laptop
but in the C# visual studio 2005 when i located the sql file and pressed "testconnection" it gave me the following error:

"the file "sniper\\c\xx\xx.mdf" is on network path that is not supported for databasefiles.
an attempt to attach an auto-named database for file "sniper\\c\xx\xx.mdf" failed.a database whit same name exist,or specified filecon''t be opened, or its located on UNC share"

so any one can help me
thanks

推荐答案

如果"sniper"是另一台PC的名称,而"C"是网络共享数据库的名称在,请尝试:

\\ sniper \ c \ xx \ xx.mdf

如果失败,请尝试转到:

\\ sniper \

在我的电脑"中查看会发生什么.


重新阅读问题,这不是问题(我可能是个木偶...).请参阅我的其他答案.
If ''sniper'' is the name of the other PC, and ''C'' is the name of the network share the database is in, try:

\\sniper\c\xx\xx.mdf

If that fails, try going to:

\\sniper\

in My Computer and see what happens.


Rereading the question, this isn''t the problem (and I was probably being a muppet...). See my other answer.


我刚刚再次查看了您收到的错误消息:


I have just looked again at the error message you''re receiving:


dabbourabd写道:
dabbourabd wrote:

文件" sniper \\ c \ xx \ xx.mdf"位于不支持的网络路径上数据库文件.
尝试为文件"sniper \\ c \ xx \ xx.mdf"附加自动命名的数据库失败.存在相同名称的数据库,或未打开指定文件的文件,或其位于UNC共享上"

"the file "sniper\\c\xx\xx.mdf" is on network path that is not supported for databasefiles.
an attempt to attach an auto-named database for file "sniper\\c\xx\xx.mdf" failed.a database whit same name exist,or specified filecon''t be opened, or its located on UNC share"



(我的重点)

对我来说,这似乎是您无法访问数据库(如果它在网络共享上).假设文件没有损坏(可以通过将其复制到本地驱动器并重试来进行测试)并且网络路径正确(可以通过将其复制到资源管理器中进行检查),这似乎是一个合理的答案.

我能提供的最佳建议是尝试将网络位置映射到驱动器,看看会发生什么,或者找到另一种连接数据库的方法.



(My emphasis)

To me, that reads as if you cannot access the database if it is on a network share. Assuming the file isn''t corrupt (can be tested by copying it to a local drive and trying again) and the network path is correct (can be checked by copying it in to Explorer), this seems like a reasonable answer.

Best suggestion I can produce is to try mapping the network location to a drive and seeing what happens, or finding another way to connect to the database.


谢谢托尼·理查兹(Tony Richards)

对此感到抱歉,但我写了当路人
路径是:\\ sniper \ xxx \ xx.mdf
sniper是存在sql文件的计算机的名称.
xxx是sql文件所在目录的名称.

但是我的意思是在c#visual Studio 2005中的数据库资源管理器窗口"中数据库连接"
添加新连接,以便它将显示窗口以找到数据库路径
并且在同一窗口中有"testconnection"按钮,因此它是自动采取路径的,它给了我错误
所以我认为当务之急不在
那你怎么想
我希望我能很好地说明我的问题

再次感谢
thank you Tony Richards

sorry about that but i wrote wronge path
the path is:\\sniper\xxx\xx.mdf
sniper is the name of computer where sql file exist.
xxx is the name of the directory where sql file exist in.

but i mean in c# visual studio 2005 in "database explorer window" "databaseconnection"
add new connection so it will show window to locate the data base path
and in the same window there is "testconnection" buttom so it is take the path automaticaly and it gave me the error
so i think the wronge is not in the path
so what do you think
i hope that i explaned my problem in good way

thanks again


这篇关于数据库和家庭网络C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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