如何使用servername读取共享驱动器上的文件 [英] How to read a file on a shared drive using the servername

查看:69
本文介绍了如何使用servername读取共享驱动器上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从服务器上读取一些文本文件。

当我在我的个人计算机上使用驱动器号时它可以工作,但是因为不是每个人都使用相同的驱动器号我需要使它工作使用服务器名称\\bemech002m

但问题是我在尝试时收到错误。



I need to read some text files from a server.
It works when I use the drive letter on my personal computer, but since not every uses the same drive letter I need to make it work using the server name \\bemech002m
But the problem is that I get an error back when I try this.

private void Dutch_Click(object sender, EventArgs e)
        {
            string s = File.ReadAllText(@"C:\Users\a961835\Programming");
            textBox1.Text = s;
        }





mscorlib.dll中出现System.IO.DirectoryNotFoundException类型的第一次机会异常



附加信息:找不到路径的一部分''C:\ Users \ a961835 \Programming''。



如果有这个例外的处理程序,程序可以安全地继续。



有什么建议吗?



A first chance exception of type ''System.IO.DirectoryNotFoundException'' occurred in mscorlib.dll

Additional information: Could not find a part of the path ''C:\Users\a961835\Programming''.

If there is a handler for this exception, the program may be safely continued.

Any suggestions?

推荐答案

好的,感谢所有的建议,我发现了我的愚蠢错误。

并感谢Chill60指出它;)



路径应为\\bemech002m \BemechData2 \ITSB \ Service_Desk \_Remedy Email Reply Scripts\ Remedy Scripts Central \Dutch
Ok, thanks for all the advise, I found my stupid mistake.
And thanks Chill60 to point it out ;)

The path should be "\\bemech002m\BemechData2\ITSB\Service_Desk\_Remedy Email Reply Scripts\Remedy Scripts Central\Dutch"


这篇关于如何使用servername读取共享驱动器上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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