Nick3
Nick3

Reputation: 639

Server path in SQL query

I have a problem with reading a file from a Windows service that is on an other computer on the network.

If I have a file locally I just give the path for example.. C:\test\

I just write C:\\Test\\ and it works great, but on the server with this address \\\Server\Test\

I don't know what to write... I would love some help!

/Nick

Upvotes: 0

Views: 408

Answers (2)

Seph
Seph

Reputation: 8703

I think you're just looking for:

string myPath = @"\\Server\Test";

or:

string myPath = "\\\\Server\\Test";

This doesn't seem to be anything related to SQL-Server, and is just a simple C# string question.

In general you just replace \ with \\ so if there's normally two \ next to each-other in the path (such as \\server) you want to then have \\\\

Upvotes: 1

Voislav Sauca
Voislav Sauca

Reputation: 3075

If it is a windows local machine Windows try to change the folder (x86), i have the same problem some time ago and for some reason is not working in the default folder x86., or if is a SQL server take a look at this post.

Don't forget that you need to create the file \Test in folder \\Server in order to access it.

Upvotes: 0

Related Questions